diff options
author | Nick Thomas <nick@gitlab.com> | 2021-03-17 18:53:54 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2021-03-17 18:53:54 +0000 |
commit | 88f94337bb87c0cc51f6badf7a4ff1826f25efaa (patch) | |
tree | 130f2777342645018f3f6b797ee0083d65910889 /internal/gitlabnet/twofactorrecover/client_test.go | |
parent | 4b40a2cb8c71a5b490cad4c8e1ad2dc0e9b39548 (diff) | |
parent | ee41d0dfb7b02a19f5926bfe24dbad1df417a29e (diff) | |
download | gitlab-shell-88f94337bb87c0cc51f6badf7a4ff1826f25efaa.tar.gz |
Merge branch 'id-refactor-cleanup' into 'main'
Replace cleanup functions with t.Cleanup
See merge request gitlab-org/gitlab-shell!460
Diffstat (limited to 'internal/gitlabnet/twofactorrecover/client_test.go')
-rw-r--r-- | internal/gitlabnet/twofactorrecover/client_test.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/internal/gitlabnet/twofactorrecover/client_test.go b/internal/gitlabnet/twofactorrecover/client_test.go index 55656a8..62f88dc 100644 --- a/internal/gitlabnet/twofactorrecover/client_test.go +++ b/internal/gitlabnet/twofactorrecover/client_test.go @@ -81,8 +81,7 @@ func initialize(t *testing.T) { } func TestGetRecoveryCodesByKeyId(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) args := &commandargs.Shell{GitlabKeyId: "0"} result, err := client.GetRecoveryCodes(context.Background(), args) @@ -91,8 +90,7 @@ func TestGetRecoveryCodesByKeyId(t *testing.T) { } func TestGetRecoveryCodesByUsername(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) args := &commandargs.Shell{GitlabUsername: "jane-doe"} result, err := client.GetRecoveryCodes(context.Background(), args) @@ -101,8 +99,7 @@ func TestGetRecoveryCodesByUsername(t *testing.T) { } func TestMissingUser(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) args := &commandargs.Shell{GitlabKeyId: "1"} _, err := client.GetRecoveryCodes(context.Background(), args) @@ -110,8 +107,7 @@ func TestMissingUser(t *testing.T) { } func TestErrorResponses(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) testCases := []struct { desc string @@ -146,12 +142,12 @@ func TestErrorResponses(t *testing.T) { } } -func setup(t *testing.T) (*Client, func()) { +func setup(t *testing.T) *Client { initialize(t) - url, cleanup := testserver.StartSocketHttpServer(t, requests) + url := testserver.StartSocketHttpServer(t, requests) client, err := NewClient(&config.Config{GitlabUrl: url}) require.NoError(t, err) - return client, cleanup + return client } |