Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add basic test

  • Loading branch information...
commit 56486cbe63918a8f200cd96a35086817ae409f6e 1 parent f9dd2dd
@Suor authored
Showing with 24 additions and 7 deletions.
  1. +3 −3 requirements.txt
  2. +3 −0  test_requirements.txt
  3. +18 −4 tests/tests.py
View
6 requirements.txt
@@ -1,3 +1,3 @@
-django
-redis
-simplejson
+django>=1.2
+redis>=2.2.4
+simplejson>=2.1.5
View
3  test_requirements.txt
@@ -0,0 +1,3 @@
+django>=1.3
+redis>=2.2.4
+simplejson>=2.1.5
View
22 tests/tests.py
@@ -1,4 +1,18 @@
-__test__ = {"doctest": """
->>> 1 + 1
-2
-"""}
+from django.test import TestCase
+
+from cacheops.conf import redis_conn
+from .models import Category, Post
+
+
+class BaseTestCase(TestCase):
+ def setUp(self):
+ super(BaseTestCase, self).setUp()
+ redis_conn.flushdb()
+
+
+class BasicTests(BaseTestCase):
+ def test_it_works(self):
+ with self.assertNumQueries(1):
+ cnt1 = Category.objects.cache().count()
+ cnt2 = Category.objects.cache().count()
+ self.assertEqual(cnt1, cnt2)
Please sign in to comment.
Something went wrong with that request. Please try again.