From 50d26c18256debaadbc4fc7433478d7413f86da8 Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Tue, 4 Oct 2011 22:26:07 -0700
Subject: [PATCH] added tests for randomness fix

---
 helios/tests.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/helios/tests.py b/helios/tests.py
index acce775..0705dc8 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')
-- 
GitLab