Skip to content
Snippets Groups Projects
Commit d6f51344 authored by Ben Adida's avatar Ben Adida
Browse files

Added a bunch of black box tests

parent 219f5131
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ import models ...@@ -8,6 +8,7 @@ import models
from auth import models as auth_models from auth import models as auth_models
from views import ELGAMAL_PARAMS from views import ELGAMAL_PARAMS
import views import views
import utils
from django.db import IntegrityError, transaction from django.db import IntegrityError, transaction
...@@ -221,12 +222,25 @@ class ElectionBlackboxTests(TestCase): ...@@ -221,12 +222,25 @@ class ElectionBlackboxTests(TestCase):
self.assertContains(response, self.election.description) self.assertContains(response, self.election.description)
def test_get_election_questions(self): def test_get_election_questions(self):
assert False response = self.client.get("/helios/elections/%s/questions" % self.election.uuid, follow=False)
for q in self.election.questions:
self.assertContains(response, q['question'])
def test_get_election_trustees(self): def test_get_election_trustees(self):
assert False response = self.client.get("/helios/elections/%s/trustees" % self.election.uuid, follow=False)
for t in self.election.trustee_set.all():
self.assertContains(response, t.name)
def test_get_election_voters(self): def test_get_election_voters(self):
assert False response = self.client.get("/helios/elections/%s/voters/list" % self.election.uuid, follow=False)
# check total count of voters
if self.election.num_voters == 0:
self.assertContains(response, "no voters")
else:
self.assertContains(response, "(of %s)" % self.election.num_voters)
def test_get_election_voters_raw(self):
response = self.client.get("/helios/elections/%s/voters/" % self.election.uuid, follow=False)
self.assertEquals(len(utils.from_json(response.content)), self.election.num_voters)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment