Skip to content
Snippets Groups Projects
Unverified Commit 53c42db2 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

[tests] Add admin user fixture and test accessibility of stats

parent 69ec942a
Branches
No related tags found
No related merge requests found
[{"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
...@@ -491,6 +491,26 @@ class ElectionBlackboxTests(WebTest): ...@@ -491,6 +491,26 @@ class ElectionBlackboxTests(WebTest):
new_election = models.Election.objects.get(uuid = self.election.uuid) new_election = models.Election.objects.get(uuid = self.election.uuid)
self.assertEquals(new_election.short_name, self.election.short_name + "-2") 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): def _setup_complete_election(self, election_params=None):
"do the setup part of a whole election" "do the setup part of a whole election"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment