Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests are reorganized

--HG--
rename : slacker/django_backend/models.py => test_project/testapp/models.py
rename : slacker/django_backend/tests.py => test_project/testapp/tests/django_tests.py
  • Loading branch information...
commit b72160b3f13290b464ef4d05d894bbdd03d49c1b 1 parent 88db72b
@kmike authored
View
2  runtests.py
@@ -12,7 +12,7 @@
sys.argv.insert(1, 'test')
if len(sys.argv) == 2:
- sys.argv.extend(['slacker', 'django_backend'])
+ sys.argv.extend(['testapp'])
from test_project import settings
execute_manager(settings)
View
1  slacker/models.py
@@ -1 +0,0 @@
-#hello!
View
4 test_project/settings.py
@@ -44,7 +44,5 @@
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
-
- 'slacker',
- 'slacker.django_backend',
+ 'testapp',
)
View
1  test_project/testapp/__init__.py
@@ -0,0 +1 @@
+
View
0  slacker/django_backend/models.py → test_project/testapp/models.py
File renamed without changes
View
6 test_project/testapp/tests/__init__.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+
+from slacker.tests import *
+from .django_tests import *
+from .workers import *
+
View
23 test_project/testapp/tests/django_tests.py
@@ -0,0 +1,23 @@
+from __future__ import absolute_import
+import pickle
+from django.test import TransactionTestCase as DjangoTestCase
+from django.contrib.auth.models import User
+from slacker.postpone import Postponed
+
+class DjangoQueryPostponeTest(DjangoTestCase):
+
+ def setUp(self):
+ self.user = User.objects.create_user('example', 'example@example.com')
+
+ @property
+ def AsyncUser(self):
+ return Postponed(User)
+
+ def test_restore(self):
+ user_query = self.AsyncUser.objects.get(username='example')
+ self.assertEqual(user_query._proceed(), self.user)
+
+ def test_pickling_unpickling(self):
+ user_query = self.AsyncUser.objects.get(username='example')
+ self.assertEqual(pickle.loads(user_query._pickled)._proceed(), self.user)
+
View
23 slacker/django_backend/tests.py → test_project/testapp/tests/workers.py
@@ -1,34 +1,16 @@
-from __future__ import absolute_import
-import pickle
+
from tornado.testing import AsyncHTTPTestCase
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
+
from django.core.handlers.wsgi import WSGIHandler
from django.test import TransactionTestCase as DjangoTestCase
from django.contrib.auth.models import User
from slacker import Slacker, adisp
-from slacker.postpone import Postponed
from slacker.workers import ThreadWorker, DjangoWorker
-class DjangoQueryPostponeTest(DjangoTestCase):
-
- def setUp(self):
- self.user = User.objects.create_user('example', 'example@example.com')
-
- @property
- def AsyncUser(self):
- return Postponed(User)
-
- def test_restore(self):
- user_query = self.AsyncUser.objects.get(username='example')
- self.assertEqual(user_query._proceed(), self.user)
-
- def test_pickling_unpickling(self):
- user_query = self.AsyncUser.objects.get(username='example')
- self.assertEqual(pickle.loads(user_query._pickled)._proceed(), self.user)
-
class BaseWorkerTest(AsyncHTTPTestCase, DjangoTestCase):
SlackerClass = Slacker(User)
@@ -64,3 +46,4 @@ def setUp(self):
class ThreadedWorkerTest(BaseWorkerTest):
SlackerClass = Slacker(User, ThreadWorker())
+
Please sign in to comment.
Something went wrong with that request. Please try again.