diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-10-01 15:57:18 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-11-17 18:49:17 +0300 |
commit | d68ea41a494b4934fcfb0c32bc489a42e82c542e (patch) | |
tree | 328e26e1dd2deff6c1e293de3f062078700cb7f3 /internal | |
parent | 8fa46057342618cb4114bc590c269983f9716ced (diff) |
test: stop calling mockController.Finish directly
This is handled by mockgen 1.5.0+
Diffstat (limited to 'internal')
-rw-r--r-- | internal/auth/auth_test.go | 6 | ||||
-rw-r--r-- | internal/handlers/handlers_test.go | 8 |
2 files changed, 0 insertions, 14 deletions
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index 6df0afcc..74c0370c 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -84,7 +84,6 @@ func TestTryAuthenticate(t *testing.T) { r := &http.Request{URL: reqURL} mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.False(t, auth.TryAuthenticate(result, r, mockSource)) @@ -101,7 +100,6 @@ func TestTryAuthenticateWithError(t *testing.T) { r := &http.Request{URL: reqURL} mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.True(t, auth.TryAuthenticate(result, r, mockSource)) @@ -124,7 +122,6 @@ func TestTryAuthenticateWithCodeButInvalidState(t *testing.T) { session.Save(r, result) mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.True(t, auth.TryAuthenticate(result, r, mockSource)) @@ -150,7 +147,6 @@ func TestTryAuthenticateRemoveTokenFromRedirect(t *testing.T) { session.Save(r, result) mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.True(t, auth.TryAuthenticate(result, r, mockSource)) @@ -170,7 +166,6 @@ func TestTryAuthenticateWithDomainAndState(t *testing.T) { r := &http.Request{URL: reqURL} mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.True(t, auth.TryAuthenticate(result, r, mockSource)) @@ -231,7 +226,6 @@ func testTryAuthenticateWithCodeAndState(t *testing.T, https bool) { result := httptest.NewRecorder() mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockSource := mocks.NewMockSource(mockCtrl) require.True(t, auth.TryAuthenticate(result, r, mockSource)) diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go index 33a0cdb2..a5044d09 100644 --- a/internal/handlers/handlers_test.go +++ b/internal/handlers/handlers_test.go @@ -15,7 +15,6 @@ import ( func TestNotHandleArtifactRequestReturnsFalse(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockArtifact := mocks.NewMockArtifact(mockCtrl) mockArtifact.EXPECT(). @@ -41,7 +40,6 @@ func TestNotHandleArtifactRequestReturnsFalse(t *testing.T) { func TestHandleArtifactRequestedReturnsTrue(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockArtifact := mocks.NewMockArtifact(mockCtrl) mockArtifact.EXPECT(). @@ -65,7 +63,6 @@ func TestHandleArtifactRequestedReturnsTrue(t *testing.T) { func TestNotFoundWithTokenIsNotHandled(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockAuth := mocks.NewMockAuth(mockCtrl) mockAuth.EXPECT().CheckResponseForInvalidToken(gomock.Any(), gomock.Any(), gomock.Any()). @@ -104,7 +101,6 @@ func TestForbiddenWithTokenIsNotHandled(t *testing.T) { for tn, tc := range cases { t.Run(tn, func(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockAuth := mocks.NewMockAuth(mockCtrl) if tc.Token == "" { @@ -130,7 +126,6 @@ func TestForbiddenWithTokenIsNotHandled(t *testing.T) { func TestNotFoundWithoutTokenIsNotHandledWhenNotAuthSupport(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockAuth := mocks.NewMockAuth(mockCtrl) mockAuth.EXPECT().IsAuthSupported().Return(false) @@ -147,7 +142,6 @@ func TestNotFoundWithoutTokenIsNotHandledWhenNotAuthSupport(t *testing.T) { } func TestNotFoundWithoutTokenIsHandled(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockAuth := mocks.NewMockAuth(mockCtrl) mockAuth.EXPECT().IsAuthSupported().Return(true) @@ -165,7 +159,6 @@ func TestNotFoundWithoutTokenIsHandled(t *testing.T) { } func TestInvalidTokenResponseIsHandled(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockAuth := mocks.NewMockAuth(mockCtrl) mockAuth.EXPECT().CheckResponseForInvalidToken(gomock.Any(), gomock.Any(), gomock.Any()). @@ -184,7 +177,6 @@ func TestInvalidTokenResponseIsHandled(t *testing.T) { func TestHandleArtifactRequestButGetTokenFails(t *testing.T) { mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() mockArtifact := mocks.NewMockArtifact(mockCtrl) mockArtifact.EXPECT(). |