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

set up testing infrastructure for other data formats

parent f5ed804c
No related branches found
No related tags found
No related merge requests found
......@@ -217,13 +217,7 @@ class CastVoteModelTests(TestCase):
## Black box tests
##
class LegacyElectionBlackboxTests(TestCase):
fixtures = ['legacy-data.json']
EXPECTED_ELECTION_FILE = 'helios/fixtures/legacy-election-expected.json'
EXPECTED_VOTERS_FILE = 'helios/fixtures/legacy-election-voters-expected.json'
EXPECTED_TRUSTEES_FILE = 'helios/fixtures/legacy-trustees-expected.json'
EXPECTED_BALLOTS_FILE = 'helios/fixtures/legacy-ballots-expected.json'
class DataFormatBlackboxTests(object):
def setUp(self):
self.election = models.Election.objects.all()[0]
......@@ -248,6 +242,28 @@ class LegacyElectionBlackboxTests(TestCase):
response = self.client.get("/helios/elections/%s/ballots/" % self.election.uuid, follow=False)
self.assertEqualsToFile(response, self.EXPECTED_BALLOTS_FILE)
## now we have a set of fixtures and expected results for various formats
## note how TestCase is used as a "mixin" here, so that the generic DataFormatBlackboxTests
## does not register as a set of test cases to run, but each concrete data format does.
class LegacyElectionBlackboxTests(DataFormatBlackboxTests, TestCase):
fixtures = ['legacy-data.json']
EXPECTED_ELECTION_FILE = 'helios/fixtures/legacy-election-expected.json'
EXPECTED_VOTERS_FILE = 'helios/fixtures/legacy-election-voters-expected.json'
EXPECTED_TRUSTEES_FILE = 'helios/fixtures/legacy-trustees-expected.json'
EXPECTED_BALLOTS_FILE = 'helios/fixtures/legacy-ballots-expected.json'
class V3_1_ElectionBlackboxTests(DataFormatBlackboxTests, TestCase):
fixtures = ['v3.1-data.json']
EXPECTED_ELECTION_FILE = 'helios/fixtures/v3.1-election-expected.json'
EXPECTED_VOTERS_FILE = 'helios/fixtures/v3.1-election-voters-expected.json'
EXPECTED_TRUSTEES_FILE = 'helios/fixtures/v3.1-trustees-expected.json'
EXPECTED_BALLOTS_FILE = 'helios/fixtures/v3.1-ballots-expected.json'
##
## overall operation of the system
##
class ElectionBlackboxTests(TestCase):
fixtures = ['users.json', 'election.json']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment