def app(request): """Fixture for use Webtest (django-webtest)""" from django_webtest import WebTestMixin wt = WebTestMixin() wt._patch_settings() request.addfinalizer(wt._unpatch_settings) wt.renew_app() return wt.app
def app(request): """WebTest's TestApp. Patch and unpatch settings before and after each test. WebTestMixin, when used in a unittest.TestCase, automatically calls _patch_settings() and _unpatchsettings. """ wtm = WebTestMixin() wtm._patch_settings() request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def webtest(request, transactional_db): """ Provide the "app" object from WebTest as a fixture Taken and adapted from https://gist.github.com/magopian/6673250 """ # Patch settings on startup wtm = WebTestMixin() wtm._patch_settings() # Unpatch settings on teardown request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def django_app_factory(): app_mixin = WebTestMixin() def factory(csrf_checks=True, extra_environ=None): app_mixin.csrf_checks = csrf_checks if extra_environ: app_mixin.extra_environ = extra_environ app_mixin._patch_settings() app_mixin.renew_app() return app_mixin.app yield factory app_mixin._unpatch_settings()
def app(request): """WebTest's TestApp. Patch and unpatch settings before and after each test. WebTestMixin, when used in a unittest.TestCase, automatically calls _patch_settings() and _unpatchsettings. source: https://gist.github.com/magopian/6673250 """ wtm = WebTestMixin() wtm._patch_settings() request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def app(request, admin_user): """WebTest's TestApp. Patch and unpatch settings before and after each test. WebTestMixin, when used in a unittest.TestCase, automatically calls _patch_settings() and _unpatchsettings. source: https://gist.github.com/magopian/6673250 """ wtm = WebTestMixin() wtm._patch_settings() request.addfinalizer(wtm._unpatch_settings) return SigiTestApp(default_user=admin_user.username)
def app(request, admin_user): """WebTest's TestApp. Patch and unpatch settings before and after each test. WebTestMixin, when used in a unittest.TestCase, automatically calls _patch_settings() and _unpatchsettings. source: https://gist.github.com/magopian/6673250 """ wtm = WebTestMixin() wtm._patch_settings() request.addfinalizer(wtm._unpatch_settings) # XXX change this admin user to "saploper" return OurTestApp(default_user=admin_user.username)
def app(request): """WebTest's TestApp. Patch and unpatch settings before and after each test. WebTestMixin, when used in a unittest.TestCase, automatically calls _patch_settings() and _unpatchsettings. from: https://gist.github.com/magopian/6673250 """ wtm = WebTestMixin() wtm._patch_settings() request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def webtest(request, webtest_csrf_checks, transactional_db): """ Provide the "app" object from WebTest as a fixture Taken and adapted from https://gist.github.com/magopian/6673250 """ from django_webtest import DjangoTestApp, WebTestMixin # Patch settings on startup wtm = WebTestMixin() wtm.csrf_checks = webtest_csrf_checks wtm._patch_settings() # Unpatch settings on teardown request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def webtest(request, webtest_csrf_checks): """ Provide the "app" object from WebTest as a fixture Taken and adapted from https://gist.github.com/magopian/6673250 """ from django_webtest import DjangoTestApp, WebTestMixin # Patch settings on startup wtm = WebTestMixin() wtm.csrf_checks = webtest_csrf_checks wtm._patch_settings() # Unpatch settings on teardown request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()
def App(request, db): mixin = WebTestMixin() mixin._patch_settings() mixin._disable_csrf_checks() request.addfinalizer(mixin._unpatch_settings) def factory(): return DjangoTestApp(extra_environ=mixin.extra_environ) return factory
def django_app_mixin(): app_mixin = WebTestMixin() return app_mixin
def app(self): wt = WebTestMixin() wt._patch_settings() wt.renew_app() return wt.app
def app(request): wtm = WebTestMixin() wtm._patch_settings() wtm._disable_csrf_checks() request.addfinalizer(wtm._unpatch_settings) return DjangoTestApp()