-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99deb02
commit 3e97904
Showing
2 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,14 +196,58 @@ func TestUserResource_CreateUser(t *testing.T) { | |
client := NewClient() | ||
|
||
want, _ := client.User.CreateUser(userEmail) | ||
got, _ := client.User.GetUserByEmail(context.TODO(), userEmail) | ||
got, _ := client.User.GetUserByEmail(userEmail) | ||
|
||
if !reflect.DeepEqual(got, want) { | ||
t.Errorf("got %v want %v", got, want) | ||
} | ||
}) | ||
} | ||
|
||
func TestGroupResource_AddUserToGroup(t *testing.T) { | ||
t.Run("should err if group doesn't exist", func(t *testing.T) { | ||
userEmailArg := "[email protected]" | ||
groupNameArg := "NonexistentUser" | ||
|
||
client := NewClient() | ||
client.User.CreateUser(userEmailArg) | ||
|
||
_, err := client.Group.AddUserToGroup(context.TODO(), groupNameArg, userEmailArg) | ||
|
||
if err == nil { | ||
t.Errorf("expected error but didn't get one") | ||
} | ||
}) | ||
|
||
t.Run("should err if user doesn't exist", func(t *testing.T) { | ||
userEmailArg := "NonexistentUser" | ||
groupNameArg := "TestGroup" | ||
|
||
client := NewClient() | ||
group, _, _ := client.Group.CreateGroup(context.TODO(), *NewGroup(groupNameArg)) | ||
_, err := client.Group.AddUserToGroup(context.TODO(), group.Id, userEmailArg) | ||
|
||
if err == nil { | ||
t.Errorf("expected error but didn't get one %v", err) | ||
} | ||
}) | ||
|
||
t.Run("should add user to group", func(t *testing.T) { | ||
userEmailArg := "[email protected]" | ||
groupNameArg := "TestGroup" | ||
|
||
client := NewClient() | ||
group, _, _ := client.Group.CreateGroup(context.TODO(), *NewGroup(groupNameArg)) | ||
user, _ := client.User.CreateUser(userEmailArg) | ||
|
||
client.Group.AddUserToGroup(context.TODO(), group.Id, user.Id) | ||
|
||
if !client.Group.GroupContainsUser(*group, userEmailArg) { | ||
t.Errorf("expected group %v to contain user %v but it did not", groupNameArg, userEmailArg) | ||
} | ||
}) | ||
} | ||
|
||
func TestUserResource_ListUsers(t *testing.T) { | ||
client := NewClient() | ||
userEmailArg1 := "TestUser1" | ||
|