-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add can_delete key to the users endpoint
Used to backend hide remove user button if user cannot be removed by currently authenticated user
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 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 |
---|---|---|
|
@@ -122,6 +122,22 @@ def test_list_users(self): | |
self.assertEqual("web.mit.edu/chomsky", noam.get("home_page")) # noqa | ||
self.assertEqual("Professor of Linguistics", noam.get("description")) # noqa | ||
self.assertEqual("Cambridge, MA", noam.get("location")) | ||
self.assertTrue(noam.get("can_delete")) | ||
|
||
def test_siteadm_can_delete(self): | ||
self.set_siteadm() | ||
api.user.create( | ||
email="[email protected]", | ||
roles=["Manager"], | ||
username="manager", | ||
password="managerpassword", | ||
) | ||
transaction.commit() | ||
|
||
response = self.api_session.get("/@users") | ||
|
||
manager = [x for x in response.json() if x.get("username") == "manager"][0] | ||
self.assertFalse(manager.get("can_delete")) | ||
|
||
def test_list_users_without_being_manager(self): | ||
noam_api_session = RelativeSession(self.portal_url, test=self) | ||
|