Browse Source

cannot vote for places not part of the group

master
Julio Biason 11 years ago
parent
commit
b7c8274f31
  1. 17
      tests/vote_tests.py

17
tests/vote_tests.py

@ -123,6 +123,23 @@ class TestVote(LunchoTests):
request, request,
token=token) token=token)
self.assertJsonError(rv, 406, 'User already voted today') self.assertJsonError(rv, 406, 'User already voted today')
return
def test_vote_place_not_in_group(self):
"""Vote for a place that doesn't belong to the group."""
group = self._group()
place1 = self._place()
place2 = self._place()
group.places.append(place2)
self.user.groups.append(group)
server.db.session.commit()
request = {'choices': [place1.id]}
rv = self.post('/vote/{group_id}/'.format(group_id=group.id),
request,
token=self.user.token)
self.assertJsonError(rv, 404, 'Places are not part of this group')
return
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

Loading…
Cancel
Save