diff --git a/helios/tests.py b/helios/tests.py index acce77566b0f4334e09a01c6fae514f47c0dda03..0705dc859d16da5565b67d487144009166ba99e4 100644 --- a/helios/tests.py +++ b/helios/tests.py @@ -568,6 +568,11 @@ class ElectionBlackboxTests(WebTest): response = self.app.post("/helios/elections/%s/encrypt-ballot" % election_id, { 'answers_json': utils.to_json([[1]])}) self.assertContains(response, "answers") + + # parse it as an encrypted vote with randomness, and make sure randomness is there + the_ballot = utils.from_json(response.testbody) + assert the_ballot['answers'][0].has_key('randomness'), "no randomness" + assert len(the_ballot['answers'][0]['randomness']) == 2, "not enough randomness" # parse it as an encrypted vote, and re-serialize it ballot = datatypes.LDObject.fromDict(utils.from_json(response.testbody), type_hint='legacy/EncryptedVote')