Python rest_framework.test.APITestCase() Examples

The following are 1 code examples for showing how to use rest_framework.test.APITestCase(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module rest_framework.test , or try the search function .

Example 1
Project: gro-api   Author: OpenAgricultureFoundation   File: test.py    License: GNU General Public License v2.0 5 votes vote down vote up
def addTest(self, test):
        if not callable(test):
            raise TypeError("The test to add must be callable")
        if (inspect.isclass(test) and
                issubclass(test, (unittest.TestCase, unittest.TestSuite))):
            raise TypeError("TestCases and TestSuites must be instantiated "
                            "before passing them to addTest()")
        if isinstance(test, APITestCase):
            for layout in test.layouts:
                if layout is not None:
                    self.configured_tests[layout].append(test)
                else:
                    self.unconfigured_tests.append(test)
        else:
            self.unconfigured_tests.append(test)