def test_ballot_is_valid(self): # Arrange factory = BallotFactory.BallotFactory() # Act subject = factory.get_simple_ballot_from_file() # Assert self.assertIsNotNone(subject.object_id) self.assertEqual(subject.object_id, "some-external-id-string-123") self.assertTrue(subject.is_valid("jefferson-county-ballot-style"))
def test_ballot_is_valid(self): # Arrange factory = BallotFactory.BallotFactory() # Act subject = factory.get_simple_ballot_from_file() first_contest = subject.contests[0] self.assertIsNotNone(first_contest) # Assert self.assertIsNotNone(subject.object_id) self.assertEqual(subject.object_id, "some-external-id-string-123") self.assertTrue(subject.is_valid("jefferson-county-ballot-style")) self.assertTrue(first_contest.is_valid("justice-supreme-court", 2, 2)) self.assertFalse(first_contest.is_valid("some-other-contest", 2, 2)) self.assertFalse(first_contest.is_valid("justice-supreme-court", 1, 2)) self.assertFalse(first_contest.is_valid("justice-supreme-court", 2, 1)) self.assertFalse( first_contest.is_valid("justice-supreme-court", 2, 2, 1))
from electionguard.tally import ( CiphertextTally, PlaintextTally, tally_ballots, ) from electionguard.utils import get_optional import electionguardtest.ballot_factory as BallotFactory import electionguardtest.election_factory as ElectionFactory from electionguardtest.election import election_descriptions, plaintext_voted_ballots from electionguardtest.tally import accumulate_plaintext_ballots election_factory = ElectionFactory.ElectionFactory() ballot_factory = BallotFactory.BallotFactory() identity_auxiliary_decrypt = lambda message, public_key: message identity_auxiliary_encrypt = lambda message, private_key: message class TestDecryptionMediator(TestCase): NUMBER_OF_GUARDIANS = 3 QUORUM = 2 CEREMONY_DETAILS = CeremonyDetails(NUMBER_OF_GUARDIANS, QUORUM) def setUp(self): self.key_ceremony = KeyCeremonyMediator(self.CEREMONY_DETAILS) self.guardians: List[Guardian] = []