Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/polls/tests/poll_result_file_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/polls/tests/poll_result_file_tests.py')
-rw-r--r--webapp/polls/tests/poll_result_file_tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/webapp/polls/tests/poll_result_file_tests.py b/webapp/polls/tests/poll_result_file_tests.py
index b57e475..f5b4178 100644
--- a/webapp/polls/tests/poll_result_file_tests.py
+++ b/webapp/polls/tests/poll_result_file_tests.py
@@ -164,3 +164,26 @@ class NumeroEscuelaTest(MongoTestCase):
result = PollResultFile(file_path)
self.assertEqual(set([numero_escuela]), result.get_numero_escuela())
+
+ def test_it_should_get_all_numero_escuela_as_unique_items(self):
+ data = self.data
+ numero_escuela1 = '1'
+ data['result']['0']['polled']['NUM_ESC'] = numero_escuela1
+ numero_escuela2 = '2'
+ data['result']['1'] = {}
+ data['result']['1']['polled'] = {}
+ data['result']['1']['polled']['NUM_ESC'] = numero_escuela2
+ data['result']['2'] = {}
+ data['result']['2']['polled'] = {}
+ data['result']['2']['polled']['NUM_ESC'] = numero_escuela2
+
+ json_str = json_construc(data)
+ file_ = tempfile.NamedTemporaryFile(suffix='.poll_result',
+ delete=False)
+ file_.write(json_str)
+ file_.close()
+ file_path = file_.name
+
+ result = PollResultFile(file_path)
+ expected = set([numero_escuela1, numero_escuela2])
+ self.assertEqual(expected, result.get_numero_escuela())