class documentation

Similar to TransactionTestCase, but use `transaction.atomic()` to achieve test isolation. In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior). On database backends with no transaction support, TestCase behaves as TransactionTestCase.

Class Method captureOnCommitCallbacks Context manager to capture transaction.on_commit() callbacks.
Class Method setUpClass Undocumented
Class Method setUpTestData Load initial data for the TestCase.
Class Method tearDownClass Undocumented
Instance Variable atomics Undocumented
Class Method _databases_support_transactions Undocumented
Class Method _enter_atomics Open atomic blocks for multiple databases.
Class Method _rollback_atomics Rollback atomic blocks opened by the previous method.
Method _fixture_setup Undocumented
Method _fixture_teardown Undocumented
Method _should_check_constraints Undocumented
Method _should_reload_connections Undocumented

Inherited from TransactionTestCase:

Method assertNumQueries Undocumented
Method assertQuerysetEqual Undocumented
Class Variable available_apps Undocumented
Class Variable databases Undocumented
Class Variable fixtures Undocumented
Class Variable reset_sequences Undocumented
Class Variable serialized_rollback Undocumented
Class Method _databases_names Undocumented
Method _post_teardown Perform post-test things: * Flush the contents of the database to leave a clean slate. If the class has an 'available_apps' attribute, don't fire post_migrate. * Force-close the connection so the next test gets a clean cursor.
Method _pre_setup Perform pre-test setup: * If the class has an 'available_apps' attribute, restrict the app registry to these applications, then fire the post_migrate signal -- it must run with the correct set of applications for the test case...
Method _reset_sequences Undocumented
Class Variable _disallowed_database_msg Undocumented

Inherited from SimpleTestCase (via TransactionTestCase):

Method __call__ Wrapper around default __call__ method to perform common Django test set up. This means that user-defined Test Cases aren't required to include a call to super().setUp().
Method assertContains Assert that a response indicates that some content was retrieved successfully, (i.e., the HTTP status code was as expected) and that ``text`` occurs ``count`` times in the content of the response. If ``count`` is None, the count doesn't matter - the assertion is true if the text occurs at least once in the response.
Method assertFieldOutput Assert that a form field behaves correctly with various inputs.
Method assertFormError Assert that a field named "field" on the given form object has specific errors.
Method assertFormsetError Similar to assertFormError() but for formsets.
Method assertHTMLEqual Assert that two HTML snippets are semantically the same. Whitespace in most cases is ignored, and attribute ordering is not significant. The arguments must be valid HTML.
Method assertHTMLNotEqual Assert that two HTML snippets are not semantically equivalent.
Method assertInHTML Undocumented
Method assertJSONEqual Assert that the JSON fragments raw and expected_data are equal. Usual JSON non-significant whitespace rules apply as the heavyweight is delegated to the json library.
Method assertJSONNotEqual Assert that the JSON fragments raw and expected_data are not equal. Usual JSON non-significant whitespace rules apply as the heavyweight is delegated to the json library.
Method assertNoLogs Assert no messages are logged on the logger, with at least the given level.
Method assertNotContains Assert that a response indicates that some content was retrieved successfully, (i.e., the HTTP status code was as expected) and that ``text`` doesn't occur in the content of the response.
Method assertRaisesMessage Assert that expected_message is found in the message of a raised exception.
Method assertRedirects Assert that a response redirected to a specific URL and that the redirect URL can be loaded.
Method assertTemplateNotUsed Assert that the template with the provided name was NOT used in rendering the response. Also usable as context manager.
Method assertTemplateUsed Assert that the template with the provided name was used in rendering the response. Also usable as context manager.
Method assertURLEqual Assert that two URLs are the same, ignoring the order of query string parameters except for parameters with the same name.
Method assertWarnsMessage Same as assertRaisesMessage but for assertWarns() instead of assertRaises().
Method assertXMLEqual Assert that two XML snippets are semantically the same. Whitespace in most cases is ignored and attribute ordering is not significant. The arguments must be valid XML.
Method assertXMLNotEqual Assert that two XML snippets are not semantically equivalent. Whitespace in most cases is ignored and attribute ordering is not significant. The arguments must be valid XML.
Method debug Perform the same as __call__(), without catching the exception.
Method modify_settings A context manager that temporarily applies changes a list setting and reverts back to the original value when exiting the context.
Method settings A context manager that temporarily sets a setting and reverts to the original value when exiting the context.
Instance Variable async_client Undocumented
Instance Variable client Undocumented
Class Method _add_databases_failures Undocumented
Class Method _remove_databases_failures Undocumented
Class Method _validate_databases Undocumented
Method _assert_contains Undocumented
Method _assert_form_error Undocumented
Method _assert_raises_or_warns_cm Undocumented
Method _assert_template_used Undocumented
Method _assertFooMessage Undocumented
Method _check_test_client_response Raise a ValueError if the given response doesn't have the required attribute.
Method _get_template_used Undocumented
Method _setup_and_call Perform the following in order: pre-setup, run test, post-teardown, skipping pre/post hooks if test is set to be skipped.
Class Variable _disallowed_connection_methods Undocumented
Class Variable _modified_settings Undocumented
Class Variable _overridden_settings Undocumented
@classmethod
@contextmanager
def captureOnCommitCallbacks(cls, *, using=DEFAULT_DB_ALIAS, execute=False): (source)

Context manager to capture transaction.on_commit() callbacks.

@classmethod
def setUpTestData(cls): (source)

Load initial data for the TestCase.

@classmethod
def tearDownClass(cls): (source)

Undocumented

Undocumented

@classmethod
def _databases_support_transactions(cls): (source)

Undocumented

@classmethod
def _enter_atomics(cls): (source)

Open atomic blocks for multiple databases.

@classmethod
def _rollback_atomics(cls, atomics): (source)

Rollback atomic blocks opened by the previous method.

def _fixture_teardown(self): (source)
def _should_check_constraints(self, connection): (source)

Undocumented

def _should_reload_connections(self): (source)