From bb4669ad706c693a9c92a3bf9b03076c9ac82189 Mon Sep 17 00:00:00 2001 From: Aamir Khan Date: Sat, 11 Aug 2012 12:48:28 +0530 Subject: Add unit tests --- hyperkitty/tests/test_models.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'hyperkitty/tests/test_models.py') diff --git a/hyperkitty/tests/test_models.py b/hyperkitty/tests/test_models.py index 9a056cd..26c1c29 100644 --- a/hyperkitty/tests/test_models.py +++ b/hyperkitty/tests/test_models.py @@ -18,3 +18,27 @@ # # Author: Aamir Khan # + +import datetime +from django.test import TestCase +from hyperkitty.models import Rating, Tag + +class RatingTestCase(TestCase): + fixtures = ['rating_testdata.json'] + + def setUp(self): + super(RatingTestCase, self).setUp() + self.rating_1 = Rating.objects.get(pk=1) + self.rating_2 = Rating.objects.get(pk=2) + + def test_was_published_today(self): + # Test the value of Poll should be +1/-1 only. + self.assertTrue((self.rating_1.vote == 1) | (self.rating_1.vote == -1)) + self.assertTrue((self.rating_2.vote == 1) | (self.rating_2.vote == -1)) + +class TagTestCase(TestCase): + fixtures = ['tag_testdata.json'] + + def setUp(self): + super(TagTestCase, self).setUp() + self.tag_1 = Tag.objects.get(pk=1) -- cgit