Use authenticate and Auth Method repo functions (#242)

This commit is contained in:
Todd Knight authored and GitHub committed 2020-08-07 10:18:40 -07:00
1 parent 908a299ea3
commit f84991c0f1
17 files changed
+324 -184

No files matched your search

+8 -3
View File
@@ -13,11 +13,16 @@ import (
)
func TestAuthenticationHandler(t *testing.T) {
c := NewTestController(t, &TestControllerOpts{DefaultOrgId: "o_1234567890"})
c := NewTestController(t, &TestControllerOpts{
DefaultOrgId: "o_1234567890",
DisableAuthorizationFailures: true,
DefaultUsername: "admin",
DefaultPassword: "password123",
})
defer c.Shutdown()
resp, err := http.Post(fmt.Sprintf("%s/v1/scopes/o_1234567890/auth-methods/am_1234567890:authenticate", c.ApiAddrs()[0]), "application/json",
strings.NewReader(`{"token_type": null, "credentials": {"name":"test", "password": "test"}}`))
resp, err := http.Post(fmt.Sprintf("%s/v1/scopes/o_1234567890/auth-methods/paum_1234567890:authenticate", c.ApiAddrs()[0]), "application/json",
strings.NewReader(`{"token_type": null, "credentials": {"name":"admin", "password": "password123"}}`))
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode, "Got response: %v", resp)