Skip to content

Commit 011c124

Browse files
committed
Add User.groups integration test (which tests Group.members
1 parent 49d21bc commit 011c124

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

integration/tests/posit/connect/test_users.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@ def test_get(self):
4747
assert self.client.users.get(self.bill["guid"]) == self.bill
4848
assert self.client.users.get(self.cole["guid"]) == self.cole
4949

50+
# Also tests Groups.members
51+
def test_groups(self):
52+
try:
53+
unit_friends = self.client.groups.create(name="UnitFriends")
54+
self.client.post(
55+
f"/v1/groups/{unit_friends['guid']}/members",
56+
json={"user_guid": self.bill["guid"]},
57+
)
58+
bill_groups = self.bill.groups.find()
59+
assert len(bill_groups) == 1
60+
assert bill_groups[0]["guid"] == unit_friends["guid"]
61+
finally:
62+
groups = self.client.groups.find(prefix="UnitFriends")
63+
if len(groups) > 0:
64+
unit_friends = groups[0]
65+
unit_friends.delete()
66+
5067

5168
class TestUserContent:
5269
"""Checks behavior of the content attribute."""

tests/posit/connect/test_users.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ def test_groups(self):
166166
assert len(users) == 2 + 2
167167

168168
carlos = client.users.get(carlos_guid)
169-
print("carlos.guid", carlos["guid"])
170169
no_groups = carlos.groups.find()
171-
print("no_groups", no_groups)
172170
assert len(no_groups) == 0
173171

174172
user = users[1]

0 commit comments

Comments
 (0)