From e91c50a4571d35d66aae5e7e2827257b8daf3ad1 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sat, 19 Apr 2014 13:19:08 -0300 Subject: [PATCH] fix the test due the change on #6 --- tests/group_tests.py | 24 ++++++++++++------------ tests/users_tests.py | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/group_tests.py b/tests/group_tests.py index 08eba1c..7009d13 100644 --- a/tests/group_tests.py +++ b/tests/group_tests.py @@ -289,9 +289,9 @@ class TestUsersInGroup(LunchoTests): request = {'usernames': [new_user.username]} url = '/group/{group_id}/users/'.format(group_id=self.group.id) - rv = self.put(url, - request, - token=self.user.token) + rv = self.post(url, + request, + token=self.user.token) self.assertJsonOk(rv) return @@ -307,9 +307,9 @@ class TestUsersInGroup(LunchoTests): request = {'usernames': [new_user.username]} url = '/group/{group_id}/users/'.format(group_id=self.group.id) - rv = self.put(url, - request, - token=new_user.token) + rv = self.post(url, + request, + token=new_user.token) self.assertJsonError(rv, 403, 'User is not admin') return @@ -317,9 +317,9 @@ class TestUsersInGroup(LunchoTests): """Try to add an unknown user to the group.""" request = {'usernames': ['unknown']} url = '/group/{group_id}/users/'.format(group_id=self.group.id) - rv = self.put(url, - request, - token=self.user.token) + rv = self.post(url, + request, + token=self.user.token) # not finding users still returns a 200, but with the users in the # "not_found" field @@ -334,9 +334,9 @@ class TestUsersInGroup(LunchoTests): # the usernames are worthless, group not found should kick first request = {'usernames': ['unkonwn']} group_id = self.group.id + 10 - rv = self.put('/group/{group_id}/users/'.format(group_id=group_id), - request, - token=self.user.token) + rv = self.post('/group/{group_id}/users/'.format(group_id=group_id), + request, + token=self.user.token) self.assertJsonError(rv, 404, 'Group not found') return diff --git a/tests/users_tests.py b/tests/users_tests.py index 7c01842..9b40a95 100644 --- a/tests/users_tests.py +++ b/tests/users_tests.py @@ -18,7 +18,7 @@ class TestUsers(LunchoTests): request = {'username': 'username', 'full_name': 'full name', 'password': 'hash'} - rv = self.put('/user/', request) + rv = self.post('/user/', request) self.assertJsonOk(rv) # db check @@ -32,7 +32,7 @@ class TestUsers(LunchoTests): request = {'username': 'username', 'full_name': 'full name', 'password': 'hash'} - rv = self.put('/user/', data=request) + rv = self.post('/user/', data=request) self.assertJsonError(rv, 409, 'Username already exists') def test_no_json(self): @@ -43,7 +43,7 @@ class TestUsers(LunchoTests): def test_missing_fields(self): """Send a request with missing fields.""" request = {'password': 'hash'} - rv = self.put('/user/', request) + rv = self.post('/user/', request) self.assertJsonError(rv, 400, 'Missing fields', fields=['username', 'full_name']) @@ -66,9 +66,9 @@ class TestExistingUsers(LunchoTests): """Update user details.""" request = {'full_name': 'New User Name', 'password': 'newhash'} - rv = self.post('/user/', - request, - self.user.token) + rv = self.put('/user/', + request, + self.user.token) self.assertJsonOk(rv) @@ -81,9 +81,9 @@ class TestExistingUsers(LunchoTests): """Send a request with an unexisting token.""" request = {'full_name': 'New User Name', 'password': 'newhash'} - rv = self.post('/user/', - request, - 'no-token') + rv = self.put('/user/', + request, + 'no-token') self.assertJsonError(rv, 404, 'User not found (via token)') @@ -96,9 +96,9 @@ class TestExistingUsers(LunchoTests): request = {'full_name': 'New User Name', 'password': 'newhash'} - rv = self.post('/user/', - request, - self.user.token) + rv = self.put('/user/', + request, + self.user.token) self.assertJsonError(rv, 400, 'Invalid token')