diff --git a/helios/fixtures/users.json b/helios/fixtures/users.json index c588ce47507d1f61348d614ee99640dcbf6bc66d..c6e18b53da75aa9efbf3db52560c1e5044a1394a 100644 --- a/helios/fixtures/users.json +++ b/helios/fixtures/users.json @@ -1 +1,40 @@ -[{"pk": 1, "model": "helios_auth.user", "fields": {"info": "{}", "user_id": "ben@adida.net", "name": "Ben Adida", "user_type": "google", "token": null, "admin_p": false}},{"pk": 2, "model": "helios_auth.user", "fields": {"info": "{}", "user_id": "12345", "name": "Ben Adida", "user_type": "facebook", "token": {"access_token":"1234"}, "admin_p": false}}] \ No newline at end of file +[ + { + "pk": 1, + "model": "helios_auth.user", + "fields": { + "info": "{}", + "user_id": "ben@adida.net", + "name": "Ben Adida", + "user_type": "google", + "token": null, + "admin_p": false + } + }, + { + "pk": 2, + "model": "helios_auth.user", + "fields": { + "info": "{}", + "user_id": "12345", + "name": "Ben Adida", + "user_type": "facebook", + "token": { + "access_token": "1234" + }, + "admin_p": false + } + }, + { + "pk": 3, + "model": "helios_auth.user", + "fields": { + "info": "{}", + "user_id": "mccio@github.com", + "name": "Marco Ciotola", + "user_type": "google", + "token": null, + "admin_p": true + } + } +] \ No newline at end of file diff --git a/helios/tests.py b/helios/tests.py index a002413910b75d3768ff6aeb57472e97014e9dba..157ce2823da9cc332790cea5561cd11d8704730d 100644 --- a/helios/tests.py +++ b/helios/tests.py @@ -491,6 +491,26 @@ class ElectionBlackboxTests(WebTest): new_election = models.Election.objects.get(uuid = self.election.uuid) self.assertEquals(new_election.short_name, self.election.short_name + "-2") + def test_get_election_stats(self): + self.setup_login(from_scratch=True, user_id='mccio@github.com', user_type='google') + response = self.client.get("/helios/stats/", follow=False) + self.assertStatusCode(response, 200) + response = self.client.get("/helios/stats/force-queue", follow=False) + self.assertRedirects(response, "/helios/stats/") + response = self.client.get("/helios/stats/elections", follow=False) + self.assertStatusCode(response, 200) + response = self.client.get("/helios/stats/problem-elections", follow=False) + self.assertStatusCode(response, 200) + response = self.client.get("/helios/stats/recent-votes", follow=False) + self.assertStatusCode(response, 200) + self.clear_login() + response = self.client.get("/helios/stats/", follow=False) + self.assertStatusCode(response, 403) + self.setup_login() + response = self.client.get("/helios/stats/", follow=False) + self.assertStatusCode(response, 403) + self.clear_login() + def _setup_complete_election(self, election_params=None): "do the setup part of a whole election"