Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/polls/tests/result_tests.py
diff options
context:
space:
mode:
authorRogelio Mita <rogeliomita@activitycentral.com>2013-04-10 02:19:28 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-04-10 17:34:30 (GMT)
commit9045b66a06dccd72fbffe1da3fa819f9b29e4c07 (patch)
treec792bfc60866113c2556f78bec09f94953d80829 /webapp/polls/tests/result_tests.py
parentf088aa12fc1c5f519bc878c6ff495169f499d8af (diff)
First impression of poll results
Diffstat (limited to 'webapp/polls/tests/result_tests.py')
-rw-r--r--webapp/polls/tests/result_tests.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/webapp/polls/tests/result_tests.py b/webapp/polls/tests/result_tests.py
new file mode 100644
index 0000000..e06862d
--- /dev/null
+++ b/webapp/polls/tests/result_tests.py
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+from polls.models import Poll, PollResult
+
+from utils.test import MongoTestCase
+
+
+class PollTests(MongoTestCase):
+
+ def test_init(self):
+ data = {'name': "poll #1"}
+ poll = Poll(data=data)
+ poll_id = poll.save()
+
+ data = {'poll_id': poll_id}
+ poll_result = PollResult([data])
+
+ self.assertEqual(data, poll_result._data)
+
+ def test_validate(self):
+ pass
+
+ def test_to_python(self):
+ data = {'poll_id': 'ID'}
+ poll_result = PollResult([data])
+
+ self.assertTrue('poll_id' in poll_result.to_python().keys())
+
+ def test_save(self):
+ data = {'poll_id': "ID"}
+ poll_result = PollResult([data])
+ poll_result.save()
+
+ self.assertEqual(1, self.db.poll_results.count())
+
+ def test_get(self):
+ data = {'poll_id': 'ID'}
+ poll_result = PollResult([data])
+ poll_result_id = poll_result.save()
+
+ self.assertIsNotNone(PollResult.get(poll_result_id))