From 7348c7a7bb33ed9f65f0f47fc76a081e4e51d970 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Mon, 14 Apr 2014 21:48:57 -0300 Subject: [PATCH] cannot vote for places that doesnt exist --- tests/vote_tests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/vote_tests.py b/tests/vote_tests.py index 0a39037..f24b8ba 100644 --- a/tests/vote_tests.py +++ b/tests/vote_tests.py @@ -184,5 +184,19 @@ class TestVote(LunchoTests): self.assertJsonError(rv, 403, 'User is not member of this group') return + def test_vote_place_doesnt_exist(self): + """Vote for a place that doesnt exist.""" + group = self._group() + place = self._place() + group.places.append(place) + server.db.session.commit() + + request = {'choices': [place.id + 10]} + rv = self.post('/vote/{group_id}/'.format(group_id=group.id), + request, + token=self.user.token) + self.assertJsonError(rv, 404, 'Place not found') + return + if __name__ == '__main__': unittest.main()