How to use the djet.testcases.ViewTestCaseMixin function in djet

To help you get started, we’ve selected a few djet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sunscrapers / djet / djet / testcases.py View on Github external
def _pre_setup(self, *args, **kwargs):
        super(ViewTestCaseMixin, self)._pre_setup(*args, **kwargs)
        if self.factory_class:
            self.factory = self.factory_class(self.get_middleware_classes())
github sunscrapers / djet / djet / testcases.py View on Github external
def _get_view(self, request):
        if self.view_class:
            view = self.view_class.as_view(**self.get_view_kwargs())
        elif self.view_function:
            view = self.__class__.__dict__['view_function']
        else:
            raise Exception('Missing view_class or view_function or viewset')

        return view


class ViewTransactionTestCase(ViewTestCaseMixin, django_test.TransactionTestCase):
    pass


class ViewTestCase(ViewTestCaseMixin, django_test.TestCase):
    pass


if django.VERSION >= (1, 4):
    class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase):
        pass

if django.VERSION >= (1, 5):
    class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase):
        pass
github sunscrapers / djet / djet / testcases.py View on Github external
else:
            raise Exception('Missing view_class or view_function or viewset')

        return view


class ViewTransactionTestCase(ViewTestCaseMixin, django_test.TransactionTestCase):
    pass


class ViewTestCase(ViewTestCaseMixin, django_test.TestCase):
    pass


if django.VERSION >= (1, 4):
    class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase):
        pass

if django.VERSION >= (1, 5):
    class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase):
        pass
github sunscrapers / djet / djet / testcases.py View on Github external
response = view(request, *self.args, **self.kwargs)

        return response

    def _get_view(self, request):
        if self.view_class:
            view = self.view_class.as_view(**self.get_view_kwargs())
        elif self.view_function:
            view = self.__class__.__dict__['view_function']
        else:
            raise Exception('Missing view_class or view_function or viewset')

        return view


class ViewTransactionTestCase(ViewTestCaseMixin, django_test.TransactionTestCase):
    pass


class ViewTestCase(ViewTestCaseMixin, django_test.TestCase):
    pass


if django.VERSION >= (1, 4):
    class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase):
        pass

if django.VERSION >= (1, 5):
    class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase):
        pass
github sunscrapers / djet / djet / testcases.py View on Github external
class ViewTransactionTestCase(ViewTestCaseMixin, django_test.TransactionTestCase):
    pass


class ViewTestCase(ViewTestCaseMixin, django_test.TestCase):
    pass


if django.VERSION >= (1, 4):
    class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase):
        pass

if django.VERSION >= (1, 5):
    class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase):
        pass