New version 0.3.9
This commit is contained in:
parent
97ec47b0d5
commit
15b15b7ccc
3 changed files with 1 additions and 21 deletions
|
@ -29,12 +29,6 @@ class DjangoContext(Vows.Context):
|
||||||
if not settings_path:
|
if not settings_path:
|
||||||
raise RuntimeError('The settings_path argument is required.')
|
raise RuntimeError('The settings_path argument is required.')
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = settings_path
|
os.environ['DJANGO_SETTINGS_MODULE'] = settings_path
|
||||||
try:
|
|
||||||
from django.conf import settings
|
|
||||||
# to register all models in admin
|
|
||||||
__import__(settings.ROOT_URLCONF)
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
settings_tracker.install()
|
settings_tracker.install()
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
@ -50,7 +44,7 @@ class DjangoContext(Vows.Context):
|
||||||
if 'DJANGO_SETTINGS_MODULE' in os.environ:
|
if 'DJANGO_SETTINGS_MODULE' in os.environ:
|
||||||
return os.environ['DJANGO_SETTINGS_MODULE']
|
return os.environ['DJANGO_SETTINGS_MODULE']
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Should be implemented the "get_settings" method.')
|
return 'settings'
|
||||||
|
|
||||||
def url(self, path):
|
def url(self, path):
|
||||||
return Url(self, path)
|
return Url(self, path)
|
||||||
|
|
|
@ -12,8 +12,6 @@ from pyvows import Vows, expect
|
||||||
|
|
||||||
from django_pyvows.context import DjangoContext, DjangoHTTPContext
|
from django_pyvows.context import DjangoContext, DjangoHTTPContext
|
||||||
|
|
||||||
DjangoContext.start_environment("sandbox.settings")
|
|
||||||
|
|
||||||
@Vows.batch
|
@Vows.batch
|
||||||
class ContextTest(Vows.Context):
|
class ContextTest(Vows.Context):
|
||||||
|
|
||||||
|
|
|
@ -55,16 +55,4 @@ class ModelVows(DjangoContext):
|
||||||
def should_have_a_name_field_as_charfield_and_max_length_100(self, topic):
|
def should_have_a_name_field_as_charfield_and_max_length_100(self, topic):
|
||||||
expect(topic).to_have_field('name', models.CharField, max_length=100)
|
expect(topic).to_have_field('name', models.CharField, max_length=100)
|
||||||
|
|
||||||
class AdminModel(DjangoContext):
|
|
||||||
|
|
||||||
def should_be_registred_in_admin(self, topic):
|
|
||||||
expect(topic).to_be_in_admin()
|
|
||||||
|
|
||||||
class StringModelInAdminOptions(DjangoContext):
|
|
||||||
|
|
||||||
def topic(self, model):
|
|
||||||
return model.admin
|
|
||||||
|
|
||||||
def should_be_listed_by_name(self, topic):
|
|
||||||
expect('name' in topic.list_display).to_be_true()
|
|
||||||
|
|
||||||
|
|
Reference in a new issue