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

added tests for randomness fix

parent 69683a68
Branches
Tags
No related merge requests found
...@@ -569,6 +569,11 @@ class ElectionBlackboxTests(WebTest): ...@@ -569,6 +569,11 @@ class ElectionBlackboxTests(WebTest):
'answers_json': utils.to_json([[1]])}) 'answers_json': utils.to_json([[1]])})
self.assertContains(response, "answers") 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 # parse it as an encrypted vote, and re-serialize it
ballot = datatypes.LDObject.fromDict(utils.from_json(response.testbody), type_hint='legacy/EncryptedVote') ballot = datatypes.LDObject.fromDict(utils.from_json(response.testbody), type_hint='legacy/EncryptedVote')
encrypted_vote = ballot.serialize() encrypted_vote = ballot.serialize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment