Browse Source

fix the test due the change on #6

master
Julio Biason 11 years ago
parent
commit
e91c50a457
  1. 8
      tests/group_tests.py
  2. 12
      tests/users_tests.py

8
tests/group_tests.py

@ -289,7 +289,7 @@ class TestUsersInGroup(LunchoTests):
request = {'usernames': [new_user.username]} request = {'usernames': [new_user.username]}
url = '/group/{group_id}/users/'.format(group_id=self.group.id) url = '/group/{group_id}/users/'.format(group_id=self.group.id)
rv = self.put(url, rv = self.post(url,
request, request,
token=self.user.token) token=self.user.token)
self.assertJsonOk(rv) self.assertJsonOk(rv)
@ -307,7 +307,7 @@ class TestUsersInGroup(LunchoTests):
request = {'usernames': [new_user.username]} request = {'usernames': [new_user.username]}
url = '/group/{group_id}/users/'.format(group_id=self.group.id) url = '/group/{group_id}/users/'.format(group_id=self.group.id)
rv = self.put(url, rv = self.post(url,
request, request,
token=new_user.token) token=new_user.token)
self.assertJsonError(rv, 403, 'User is not admin') self.assertJsonError(rv, 403, 'User is not admin')
@ -317,7 +317,7 @@ class TestUsersInGroup(LunchoTests):
"""Try to add an unknown user to the group.""" """Try to add an unknown user to the group."""
request = {'usernames': ['unknown']} request = {'usernames': ['unknown']}
url = '/group/{group_id}/users/'.format(group_id=self.group.id) url = '/group/{group_id}/users/'.format(group_id=self.group.id)
rv = self.put(url, rv = self.post(url,
request, request,
token=self.user.token) token=self.user.token)
@ -334,7 +334,7 @@ class TestUsersInGroup(LunchoTests):
# the usernames are worthless, group not found should kick first # the usernames are worthless, group not found should kick first
request = {'usernames': ['unkonwn']} request = {'usernames': ['unkonwn']}
group_id = self.group.id + 10 group_id = self.group.id + 10
rv = self.put('/group/{group_id}/users/'.format(group_id=group_id), rv = self.post('/group/{group_id}/users/'.format(group_id=group_id),
request, request,
token=self.user.token) token=self.user.token)
self.assertJsonError(rv, 404, 'Group not found') self.assertJsonError(rv, 404, 'Group not found')

12
tests/users_tests.py

@ -18,7 +18,7 @@ class TestUsers(LunchoTests):
request = {'username': 'username', request = {'username': 'username',
'full_name': 'full name', 'full_name': 'full name',
'password': 'hash'} 'password': 'hash'}
rv = self.put('/user/', request) rv = self.post('/user/', request)
self.assertJsonOk(rv) self.assertJsonOk(rv)
# db check # db check
@ -32,7 +32,7 @@ class TestUsers(LunchoTests):
request = {'username': 'username', request = {'username': 'username',
'full_name': 'full name', 'full_name': 'full name',
'password': 'hash'} 'password': 'hash'}
rv = self.put('/user/', data=request) rv = self.post('/user/', data=request)
self.assertJsonError(rv, 409, 'Username already exists') self.assertJsonError(rv, 409, 'Username already exists')
def test_no_json(self): def test_no_json(self):
@ -43,7 +43,7 @@ class TestUsers(LunchoTests):
def test_missing_fields(self): def test_missing_fields(self):
"""Send a request with missing fields.""" """Send a request with missing fields."""
request = {'password': 'hash'} request = {'password': 'hash'}
rv = self.put('/user/', request) rv = self.post('/user/', request)
self.assertJsonError(rv, 400, 'Missing fields', fields=['username', self.assertJsonError(rv, 400, 'Missing fields', fields=['username',
'full_name']) 'full_name'])
@ -66,7 +66,7 @@ class TestExistingUsers(LunchoTests):
"""Update user details.""" """Update user details."""
request = {'full_name': 'New User Name', request = {'full_name': 'New User Name',
'password': 'newhash'} 'password': 'newhash'}
rv = self.post('/user/', rv = self.put('/user/',
request, request,
self.user.token) self.user.token)
@ -81,7 +81,7 @@ class TestExistingUsers(LunchoTests):
"""Send a request with an unexisting token.""" """Send a request with an unexisting token."""
request = {'full_name': 'New User Name', request = {'full_name': 'New User Name',
'password': 'newhash'} 'password': 'newhash'}
rv = self.post('/user/', rv = self.put('/user/',
request, request,
'no-token') 'no-token')
@ -96,7 +96,7 @@ class TestExistingUsers(LunchoTests):
request = {'full_name': 'New User Name', request = {'full_name': 'New User Name',
'password': 'newhash'} 'password': 'newhash'}
rv = self.post('/user/', rv = self.put('/user/',
request, request,
self.user.token) self.user.token)

Loading…
Cancel
Save