test.SimpleTestCase.assertContains()

SimpleTestCase.assertContains(response, text, count=None, status_code=200, msg_prefix='', html=False) [source] Asserts that a Response instance produced the given status_code and that text appears in the content of the response. If count is provided, text must occur exactly count times in the response. Set html to True to handle text as HTML. The comparison with the response content will be based on HTML semantics instead of character-by-character equality. Whitespace is ignored in most case

test.SimpleTestCase.assertFieldOutput()

SimpleTestCase.assertFieldOutput(fieldclass, valid, invalid, field_args=None, field_kwargs=None, empty_value='') [source] Asserts that a form field behaves correctly with various inputs. Parameters: fieldclass – the class of the field to be tested. valid – a dictionary mapping valid inputs to their expected cleaned values. invalid – a dictionary mapping invalid inputs to one or more raised error messages. field_args – the args passed to instantiate the field. field_kwargs – the kwargs

test.SimpleTestCase.assertFormError()

SimpleTestCase.assertFormError(response, form, field, errors, msg_prefix='') [source] Asserts that a field on a form raises the provided list of errors when rendered on the form. form is the name the Form instance was given in the template context. field is the name of the field on the form to check. If field has a value of None, non-field errors (errors you can access via form.non_field_errors()) will be checked. errors is an error string, or a list of error strings, that are expected as a

test.SimpleTestCase.assertFormsetError()

SimpleTestCase.assertFormsetError(response, formset, form_index, field, errors, msg_prefix='') [source] Asserts that the formset raises the provided list of errors when rendered. formset is the name the Formset instance was given in the template context. form_index is the number of the form within the Formset. If form_index has a value of None, non-form errors (errors you can access via formset.non_form_errors()) will be checked. field is the name of the field on the form to check. If field

test.SimpleTestCase.assertHTMLEqual()

SimpleTestCase.assertHTMLEqual(html1, html2, msg=None) [source] Asserts that the strings html1 and html2 are equal. The comparison is based on HTML semantics. The comparison takes following things into account: Whitespace before and after HTML tags is ignored. All types of whitespace are considered equivalent. All open tags are closed implicitly, e.g. when a surrounding tag is closed or the HTML document ends. Empty tags are equivalent to their self-closing version. The ordering of attribute

test.SimpleTestCase.assertHTMLNotEqual()

SimpleTestCase.assertHTMLNotEqual(html1, html2, msg=None) [source] Asserts that the strings html1 and html2 are not equal. The comparison is based on HTML semantics. See assertHTMLEqual() for details. html1 and html2 must be valid HTML. An AssertionError will be raised if one of them cannot be parsed. Output in case of error can be customized with the msg argument.

test.SimpleTestCase.assertInHTML()

SimpleTestCase.assertInHTML(needle, haystack, count=None, msg_prefix='') [source] Asserts that the HTML fragment needle is contained in the haystack one. If the count integer argument is specified, then additionally the number of needle occurrences will be strictly verified. Whitespace in most cases is ignored, and attribute ordering is not significant. The passed-in arguments must be valid HTML.

test.SimpleTestCase.assertJSONEqual()

SimpleTestCase.assertJSONEqual(raw, expected_data, msg=None) [source] Asserts 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. Output in case of error can be customized with the msg argument.

test.SimpleTestCase.assertJSONNotEqual()

SimpleTestCase.assertJSONNotEqual(raw, expected_data, msg=None) [source] Asserts that the JSON fragments raw and expected_data are not equal. See assertJSONEqual() for further details. Output in case of error can be customized with the msg argument.

test.SimpleTestCase.assertNotContains()

SimpleTestCase.assertNotContains(response, text, status_code=200, msg_prefix='', html=False) [source] Asserts that a Response instance produced the given status_code and that text does not appear in the content of the response. Set html to True to handle text as HTML. The comparison with the response content will be based on HTML semantics instead of character-by-character equality. Whitespace is ignored in most cases, attribute ordering is not significant. See assertHTMLEqual() for more det