Permalink
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...
kmike committed May 2, 2011
1 parent 88db72b commit b72160b3f13290b464ef4d05d894bbdd03d49c1b
View
@@ -12,7 +12,7 @@
sys.argv.insert(1, 'test') sys.argv.insert(1, 'test')
if len(sys.argv) == 2: if len(sys.argv) == 2:
sys.argv.extend(['slacker', 'django_backend']) sys.argv.extend(['testapp'])
from test_project import settings from test_project import settings
execute_manager(settings) execute_manager(settings)
View

This file was deleted.

Oops, something went wrong.
View
@@ -44,7 +44,5 @@
INSTALLED_APPS=( INSTALLED_APPS=(
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'testapp',
'slacker',
'slacker.django_backend',
) )
@@ -0,0 +1 @@
File renamed without changes.
@@ -0,0 +1,6 @@
from __future__ import absolute_import
from slacker.tests import *
from .django_tests import *
from .workers import *
@@ -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)
@@ -1,34 +1,16 @@
from __future__ import absolute_import
import pickle
from tornado.testing import AsyncHTTPTestCase from tornado.testing import AsyncHTTPTestCase
from tornado.wsgi import WSGIContainer from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from django.core.handlers.wsgi import WSGIHandler from django.core.handlers.wsgi import WSGIHandler
from django.test import TransactionTestCase as DjangoTestCase from django.test import TransactionTestCase as DjangoTestCase
from django.contrib.auth.models import User from django.contrib.auth.models import User
from slacker import Slacker, adisp from slacker import Slacker, adisp
from slacker.postpone import Postponed
from slacker.workers import ThreadWorker, DjangoWorker 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): class BaseWorkerTest(AsyncHTTPTestCase, DjangoTestCase):
SlackerClass = Slacker(User) SlackerClass = Slacker(User)
@@ -64,3 +46,4 @@ def setUp(self):
class ThreadedWorkerTest(BaseWorkerTest): class ThreadedWorkerTest(BaseWorkerTest):
SlackerClass = Slacker(User, ThreadWorker()) SlackerClass = Slacker(User, ThreadWorker())

0 comments on commit b72160b

Please sign in to comment.