From d3af266774c4602aa70706613834a3348a894bd8 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Mon, 9 Dec 2024 10:34:31 -0800 Subject: [PATCH] Update tests and mock --- test_utils.go | 4 ++-- ttl_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test_utils.go b/test_utils.go index ed38b19..46b74a4 100644 --- a/test_utils.go +++ b/test_utils.go @@ -653,9 +653,9 @@ func mockArtifactoryUsageVersionRequests(version string) { httpmock.NewStringResponder(200, versionString)) } -func mockArtifactoryRoleRequest() { +func mockArtifactoryTokenRequest() { httpmock.RegisterResponder( http.MethodGet, - "http://myserver.com:80/access/api/v1/roles/Viewer", + "http://myserver.com:80/access/api/v1/tokens/me", httpmock.NewStringResponder(200, "")) } diff --git a/ttl_test.go b/ttl_test.go index ad57e68..c4a003a 100644 --- a/ttl_test.go +++ b/ttl_test.go @@ -122,7 +122,7 @@ func TestBackend_NoUserTokensMaxTTLUsesSystemMaxTTL(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -172,7 +172,7 @@ func TestBackend_UserTokenConfigMaxTTLUseSystem(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -207,7 +207,7 @@ func TestBackend_UserTokenConfigMaxTTLUseConfigMaxTTL(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -242,7 +242,7 @@ func TestBackend_UserTokenMaxTTLUseRequestTTL(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -277,7 +277,7 @@ func TestBackend_UserTokenMaxTTLEnforced(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -313,7 +313,7 @@ func TestBackend_UserTokenTTLRequest(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost, @@ -345,7 +345,7 @@ func TestBackend_UserTokenDefaultTTL(t *testing.T) { defer httpmock.DeactivateAndReset() mockArtifactoryUsageVersionRequests("") - mockArtifactoryRoleRequest() + mockArtifactoryTokenRequest() httpmock.RegisterResponder( http.MethodPost,