Browse Source

cannot vote for groups that the user is not a member

master
Julio Biason 11 years ago
parent
commit
9bf2c81677
  1. 19
      tests/vote_tests.py

19
tests/vote_tests.py

@ -165,5 +165,24 @@ class TestVote(LunchoTests):
self.assertJsonError(rv, 404, 'Group not found') self.assertJsonError(rv, 404, 'Group not found')
return return
def test_vote_in_group_not_member(self):
"""Try to vote for a group that the user is not a member."""
group = self._group()
place = self._place()
group.places.append(place)
server.db.session.commit()
user2 = self.create_user(name='newUser',
fullname='new user',
verified=True,
create_token=True)
request = {'choices': [place.id]}
rv = self.post('/vote/{group_id}/'.format(group_id=group.id),
request,
token=user2.token)
self.assertJsonError(rv, 403, 'User is not member of this group')
return
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

Loading…
Cancel
Save