Exemplo n.º 1
0
 def topic(self):
     return DjangoContext._start_environment(None)
Exemplo n.º 2
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

# django-pyvows extensions
# https://github.com/rafaelcaricio/django-pyvows

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Rafael Caricio [email protected]

from pyvows import Vows, expect
from django_pyvows.context import DjangoContext

DjangoContext.start_environment("sandbox.settings")

from django.db import models
from sandbox.main.models import StringModel

@Vows.batch
class ModelVows(DjangoContext):

    class MainModel(DjangoContext):

        def topic(self):
            return self.model(StringModel)

        def should_be_cruddable_when_model_only_has_a_string(self, topic):
            expect(topic).to_be_cruddable()

        def should_be_cruddable_when_string_passed(self, topic):
            expect(topic).to_be_cruddable({
Exemplo n.º 3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

# django-pyvows extensions
# https://github.com/rafaelcaricio/django-pyvows

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Rafael Caricio [email protected]

from pyvows import Vows, expect

from django_pyvows.context import DjangoContext, DjangoHTTPContext
from django_pyvows.settings_manager import settings_tracker, VowsSettings

DjangoContext.start_environment("sandbox.settings")


@Vows.batch
class SettingsVows(DjangoContext):
    class WhenIUseTheSettingsTracker(DjangoContext):
        def topic(self):
            settings_tracker.install()

        class WhenImportFromDjangoConf(DjangoContext):
            def topic(self):
                from django.conf import settings
                return settings

            def should_be_the_vows_settings(self, topic):
                expect(topic).to_be_instance_of(VowsSettings)
Exemplo n.º 4
0
 def topic(self):
     return DjangoContext.start_environment(None)
Exemplo n.º 5
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

# django-pyvows extensions
# https://github.com/rafaelcaricio/django-pyvows

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Rafael Caricio [email protected]

from pyvows import Vows, expect
from django_pyvows.context import DjangoContext

DjangoContext._start_environment('sandbox.settings')

from sandbox.main.models import StringModel

@Vows.batch
class ModelVows(Vows.Context):

    class MainModel(DjangoContext):

        def topic(self):
            return self._model(StringModel)

        def should_be_cruddable_when_model_only_has_a_string(self, topic):
            expect(topic).to_be_cruddable()

        def should_be_cruddable_when_string_passed(self, topic):
            expect(topic).to_be_cruddable({
                'name': 'something'
Exemplo n.º 6
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

# django-pyvows extensions
# https://github.com/rafaelcaricio/django-pyvows

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Rafael Caricio [email protected]

from pyvows import Vows, expect
from django_pyvows.context import DjangoContext

DjangoContext._start_environment('sandbox.settings')

from sandbox.main.views import home


@Vows.batch
class UrlVows(Vows.Context):
    class Home(DjangoContext):
        def topic(self):
            return self._url('^$')

        def should_have_home_url_mapped(self, topic):
            expect(topic).to_be_mapped()

        def should_have_url_mapped_to_home_view(self, topic):
            expect(topic).to_match_view(home)
Exemplo n.º 7
0
 def topic(self):
     return DjangoContext.setup_environment(None)