-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow change of ali * update tests * fix typo * chain user updates * fix test * precommit * update tests --------- Co-authored-by: Ross Perry <[email protected]> Co-authored-by: Katherine Fleming <[email protected]>
- Loading branch information
1 parent
6305fbb
commit 1348d7c
Showing
7 changed files
with
217 additions
and
23 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
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
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 |
---|---|---|
|
@@ -455,6 +455,32 @@ def test_update_role(self): | |
}) | ||
self.assertEqual(ou.role_level, ROLE_MEMBER) | ||
|
||
def test_update_access_level_instance(self): | ||
# Setup | ||
u = User.objects.create(username='[email protected]', email='[email protected]') | ||
self.org.add_member(u, role=ROLE_VIEWER, access_level_instance_id=self.org.root.id) | ||
org_user = OrganizationUser.objects.get(user=u) | ||
|
||
self.org.access_level_names = ["root", "child"] | ||
self.org.save() | ||
child_ali = self.org.add_new_access_level_instance(self.org.root.id, "child") | ||
|
||
# Action | ||
resp = self.client.put( | ||
reverse_lazy("api:v3:user-access-level-instance", args=[u.id]) + '?organization_id=' + str( | ||
self.org.id), | ||
data=json.dumps( | ||
{ | ||
'access_level_instance_id': child_ali.id | ||
} | ||
), | ||
content_type='application/json', | ||
) | ||
|
||
# Assertion | ||
assert resp.status_code == 200 | ||
assert OrganizationUser.objects.get(pk=org_user.pk).access_level_instance_id == child_ali.id | ||
|
||
def test_allowed_to_update_role_if_not_last_owner(self): | ||
u = User.objects.create(username='[email protected]', email='[email protected]') | ||
self.org.add_member(u, role=ROLE_OWNER, access_level_instance_id=self.org.root.id) | ||
|
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