diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-09-27 12:07:16 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-09-27 12:08:38 +0300 |
commit | 9beee9f6022a745a40537c0b5d26dc8a43d35944 (patch) | |
tree | 67695b2125dd40a2be84feafa0b2443b8c3274e4 /internal/auth | |
parent | 8e11c9aa018c157966f30a4d809c7ca454d310fa (diff) |
Create a factory method for Domains to handle mutex better
Diffstat (limited to 'internal/auth')
-rw-r--r-- | internal/auth/auth_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index e8ff5e94..ad6550ac 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -54,7 +54,7 @@ func TestTryAuthenticate(t *testing.T) { require.NoError(t, err) r := request.WithHTTPSFlag(&http.Request{URL: reqURL}, true) - require.Equal(t, false, auth.TryAuthenticate(result, r, new(source.Domains))) + require.Equal(t, false, auth.TryAuthenticate(result, r, source.NewDomains())) } func TestTryAuthenticateWithError(t *testing.T) { @@ -65,7 +65,7 @@ func TestTryAuthenticateWithError(t *testing.T) { require.NoError(t, err) r := request.WithHTTPSFlag(&http.Request{URL: reqURL}, true) - require.Equal(t, true, auth.TryAuthenticate(result, r, new(source.Domains))) + require.Equal(t, true, auth.TryAuthenticate(result, r, source.NewDomains())) require.Equal(t, 401, result.Code) } @@ -82,7 +82,7 @@ func TestTryAuthenticateWithCodeButInvalidState(t *testing.T) { session.Values["state"] = "state" session.Save(r, result) - require.Equal(t, true, auth.TryAuthenticate(result, r, new(source.Domains))) + require.Equal(t, true, auth.TryAuthenticate(result, r, source.NewDomains())) require.Equal(t, 401, result.Code) } @@ -122,7 +122,7 @@ func testTryAuthenticateWithCodeAndState(t *testing.T, https bool) { }) result := httptest.NewRecorder() - require.Equal(t, true, auth.TryAuthenticate(result, r, new(source.Domains))) + require.Equal(t, true, auth.TryAuthenticate(result, r, source.NewDomains())) require.Equal(t, 302, result.Code) require.Equal(t, "https://pages.gitlab-example.com/project/", result.Header().Get("Location")) require.Equal(t, 600, result.Result().Cookies()[0].MaxAge) |