From 4ce344e7adb78124e590d3d50fd30703a00cc1e3 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sun, 6 Apr 2014 10:16:25 -0300 Subject: [PATCH] checking if the group exists --- apiary.apib | 22 ++++++++++++++++++++++ tests/group_tests.py | 10 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/apiary.apib b/apiary.apib index bd17bdc..b5b4be0 100644 --- a/apiary.apib +++ b/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 changes is the owner of the group. +### Get a list of members [GET] + +**Authenticated** + ++ Responde 200 (application/json) + + { "status": "OK", "users": [ { "username": "", + "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] + Request (application/json) diff --git a/tests/group_tests.py b/tests/group_tests.py index e3e95ed..ce44dc8 100644 --- a/tests/group_tests.py +++ b/tests/group_tests.py @@ -277,5 +277,15 @@ class TestUsersInGroup(LunchoTests): self.assertJsonError(rv, 404, '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__': unittest.main()