Add Result types to Go SDK and properly populate body/map fields (#358)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-15 01:08:21 -04:00
1 parent d8dc1ed0b2
commit a00ee7a948
61 files changed
+1888 -1099

No files matched your search

+7 -5
View File
@@ -36,16 +36,18 @@ func TestAuthenticationMulti(t *testing.T) {
defer c2.Shutdown()
auth := authmethods.NewClient(c1.Client())
token1, apiErr, err := auth.Authenticate(c1.Context(), amId, map[string]interface{}{"login_name": user, "password": password})
token1Result, apiErr, err := auth.Authenticate(c1.Context(), amId, map[string]interface{}{"login_name": user, "password": password})
require.Nil(err)
require.Nil(apiErr)
token1 := token1Result.Item
require.NotNil(token1)
time.Sleep(5 * time.Second)
auth = authmethods.NewClient(c2.Client())
token2, apiErr, err := auth.Authenticate(c2.Context(), amId, map[string]interface{}{"login_name": user, "password": password})
token2Result, apiErr, err := auth.Authenticate(c2.Context(), amId, map[string]interface{}{"login_name": user, "password": password})
require.Nil(err)
require.Nil(apiErr)
token2 := token2Result.Item
require.NotNil(token2)
assert.NotEqual(token1.Token, token2.Token)
@@ -57,10 +59,10 @@ func TestAuthenticationMulti(t *testing.T) {
org, apiErr, err := scopes.NewClient(c1.Client()).Create(c1.Context(), scope.Global.String())
require.NoError(err)
require.Nil(apiErr)
require.NotNil(org)
require.NotNil(org.Item)
proj, apiErr, err := scopes.NewClient(c2.Client()).Read(c2.Context(), org.Id)
proj, apiErr, err := scopes.NewClient(c2.Client()).Read(c2.Context(), org.Item.Id)
require.NoError(err)
require.Nil(apiErr)
require.NotNil(proj)
require.NotNil(proj.Item)
}