Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
hirosassa authored and jeremytchang committed Oct 17, 2022
1 parent 5a63c20 commit 6cb9531
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions go/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,66 @@ func TestIntegrationGoSDK(t *testing.T) {
}
})

t.Run("CRUD User Attribute Group Value", func(t *testing.T) {
name := "foo"
group, err := sdk.CreateGroup(v4.WriteGroup{
Name: &name,
}, "", nil)
if err != nil {
t.Errorf("CreateGroup() failed. error=%v", err)
}

groupId := group.Id
group, err = sdk.Group(*groupId, "", nil)
if err != nil {
t.Errorf("Group() failed. error=%v", err)
}

attributeName := "bar"
attributeLabel := "bar"
attributeType := "string"
ua, err := sdk.CreateUserAttribute(v4.WriteUserAttribute{
Name: attributeName,
Label: attributeLabel,
Type: attributeType,
}, "", nil)
if err != nil {
t.Errorf("CreateUserAttribute failed. error=%v", err)
}

uaId := ua.Id
ua, err = sdk.UserAttribute(*uaId, "", nil)
if err != nil {
t.Errorf("UserAttribute() failed. error=%v", err)
}

value := "baz"
_, err = sdk.UpdateUserAttributeGroupValue(*groupId, *uaId, v4.UserAttributeGroupValue{
GroupId: groupId,
UserAttributeId: uaId,
Value: &value,
}, nil)
if err != nil {
t.Errorf("UpdateUserAttributeGroupValue() failed. error=%v", err)
}

err = sdk.DeleteUserAttributeGroupValue(*groupId, *uaId, nil)
if err != nil {
t.Errorf("DeleteUserAttributeGroupValue() failed. error=%v", err)
}

_, err = sdk.DeleteUserAttribute(*uaId, nil)
if err != nil {
t.Errorf("DeleteUserAttribute() failed. error=%v", err)
}

_, err = sdk.DeleteGroup(*groupId, nil)
if err != nil {
t.Errorf("DeleteGroup() failed. error=%v", err)
}

})

t.Run("Me()", func(t *testing.T) {
user, err := sdk.Me("", nil)

Expand Down

0 comments on commit 6cb9531

Please sign in to comment.