Browse Source

checking if the group exists

master
Julio Biason 11 years ago
parent
commit
4ce344e7ad
  1. 22
      apiary.apib
  2. 10
      tests/group_tests.py

22
apiary.apib

@ -322,6 +322,28 @@ maintenance ownership to another user, immediatelly.
Manages the users in the group. The only user that can do these kind of Manages the users in the group. The only user that can do these kind of
changes is the owner of the group. changes is the owner of the group.
### Get a list of members [GET]
**Authenticated**
+ Responde 200 (application/json)
{ "status": "OK", "users": [ { "username": "<username>",
"full_name": "<full name>"},
... ] }
+ Response 400 (application/json)
{ "status": "ERROR", "error": "Invalid token" }
+ Response 401 (application/json)
{ "status": "ERROR", "error": "User is not admin" }
+ Response 404 (application/json)
{ "status": "ERROR", "error": "Group not found" }
### Adding members [PUT] ### Adding members [PUT]
+ Request (application/json) + Request (application/json)

10
tests/group_tests.py

@ -277,5 +277,15 @@ class TestUsersInGroup(LunchoTests):
self.assertJsonError(rv, 404, self.assertJsonError(rv, 404,
'Some users in the add list do not exist') 'Some users in the add list do not exist')
def test_add_unknown_group(self):
"""Try to add users to some unknown group."""
request = {'usernames': ['unkonwn']} # group not found should
# kick first
groupId = self.group.id + 10
rv = self.put('/group/{groupId}/users/'.format(groupId=groupId),
request,
token=self.user.token)
self.assertJsonError(rv, 404, 'Group not found')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

Loading…
Cancel
Save