@@ -26,7 +26,7 @@ assertRedirects()
26
26
27
27
.. code ::
28
28
29
- self.assertRedirects()
29
+ self.assertRedirects(response, expected_redirect_url )
30
30
31
31
Asserts that a request is redirected to a specific URL.
32
32
@@ -50,7 +50,7 @@ assertStatusCode()
50
50
51
51
.. code ::
52
52
53
- self.assertStatusCode()
53
+ self.assertStatusCode(response, expected_status )
54
54
55
55
Asserts that a response has a given status code value.
56
56
@@ -67,17 +67,20 @@ assertPageTitle()
67
67
68
68
.. code ::
69
69
70
- self.assertPageTitle()
70
+ self.assertPageTitle(response, expected_title, allow_partials=True )
71
71
72
72
Asserts that a response has a given title value. Aka, the ``<title> `` tag
73
73
contents.
74
74
75
75
:param response: Response object to check against.
76
76
:param expected_title: Expected title text that response should have.
77
- :param exact_match: Bool indicating if title needs to match exactly, or is
78
- allowed partial matches. Useful when site title is long,
79
- and tests only care about a specific subsection of the
80
- title.
77
+ :param allow_partials: Bool indicating if title needs to match exactly, or is
78
+ allowed partial matches.
79
+ Useful when site title is long, and tests only care about
80
+ a specific subsection of the title.
81
+ Defaults to False, aka must be an exact match.
82
+ For a site-wide version of this param, see
83
+ :ref: `configuration/general:ALLOW_TITLE_PARTIALS `
81
84
82
85
:return: The found title value, in case tests need to run additional logic
83
86
on it.
@@ -88,7 +91,7 @@ assertPageHeader()
88
91
89
92
.. code ::
90
93
91
- self.assertPageHeader()
94
+ self.assertPageHeader(response, expected_header )
92
95
93
96
Asserts that a response has a given page header value. Aka, the ``<h1> `` tag
94
97
contents.
@@ -98,7 +101,7 @@ However, not all sites follow this rule, and this assertion does not work
98
101
reliably in cases when there are multiple ``<h1> `` header tags on a page.
99
102
100
103
:param response: Response object to check against.
101
- :param expected_title : Expected page header text that response should have.
104
+ :param expected_header : Expected page header text that response should have.
102
105
103
106
:return: The found page header value, in case tests need to run additional
104
107
logic on it.
@@ -109,7 +112,7 @@ assertContextMessages()
109
112
110
113
.. code ::
111
114
112
- self.assertContextMessages()
115
+ self.assertContextMessages(response, expected_messages, allow_partials=True )
113
116
114
117
Asserts that a response has the given context message values. These are
115
118
usually generated with the
@@ -120,10 +123,13 @@ expected strings.
120
123
121
124
:param response: Response object to check against.
122
125
:param expected_messages: Expected messages that response should contain.
123
- :param allow_partials: Bool indicating if messages must match exactly, or
124
- are allowed partial matches. Useful for messages that
125
- are extra long, and tests only care about a specific
126
- subsection of the message.
126
+ :param allow_partials: Bool indicating if message needs to match exactly, or is
127
+ allowed partial matches.
128
+ Useful when messages are long, and tests only care about
129
+ a specific subsection of the messages.
130
+ Defaults to False, aka must be an exact match.
131
+ For a project-wide version of this param, see
132
+ :ref: `configuration/general:ALLOW_MESSAGE_PARTIALS `
127
133
128
134
:return: None.
129
135
@@ -154,7 +160,7 @@ assertNotContextMessages()
154
160
155
161
.. code ::
156
162
157
- self.assertNotContextMessages()
163
+ self.assertNotContextMessages(response, expected_not_messages, allow_partials=True )
158
164
159
165
The negation of
160
166
:ref: `test_cases/integration_test_case/other_functionality:assertContextMessages() `
@@ -168,10 +174,13 @@ expected strings.
168
174
:param response: Response object to check against.
169
175
:param expected_not_messages: Expected messages that response should NOT
170
176
contain.
171
- :param allow_partials: Bool indicating if messages must match exactly, or
172
- are allowed partial matches. Useful for messages that
173
- are extra long, and tests only care about a specific
174
- subsection of the message.
177
+ :param allow_partials: Bool indicating if message needs to match exactly, or is
178
+ allowed partial matches.
179
+ Useful when messages are long, and tests only care about
180
+ a specific subsection of the messages.
181
+ Defaults to False, aka must be an exact match.
182
+ For a project-wide version of this param, see
183
+ :ref: `configuration/general:ALLOW_MESSAGE_PARTIALS `
175
184
176
185
:return: None.
177
186
@@ -181,7 +190,7 @@ assertPageContent()
181
190
182
191
.. code ::
183
192
184
- self.assertPageContent()
193
+ self.assertPageContent(response, expected_content, ignore_ordering=True )
185
194
186
195
Asserts that a response has the given page content html.
187
196
@@ -190,8 +199,8 @@ expected strings.
190
199
191
200
:param response: Response object to check against.
192
201
:param expected_content: Expected content that response should contain.
193
- :param ignore_ordering: Bool indicating if content ordering matters. Defaults
194
- to assuming ordering should be obeyed.
202
+ :param ignore_ordering: Bool indicating if content ordering matters.
203
+ Defaults to assuming ordering should be obeyed.
195
204
:param content_starts_after: Optional content value to strip out of search
196
205
space. This value and anything above will be
197
206
removed. If multiple instances exist on page, then
@@ -212,7 +221,7 @@ assertNotPageContent()
212
221
213
222
.. code ::
214
223
215
- self.assertNotPageContent()
224
+ self.assertNotPageContent(response, expected_not_content, ignore_ordering=True )
216
225
217
226
The negation of
218
227
:ref: `test_cases/integration_test_case/other_functionality:assertPageContent() `
@@ -237,7 +246,7 @@ assertRepeatingElement()
237
246
238
247
.. code ::
239
248
240
- self.assertRepeatingElement()
249
+ self.assertRepeatingElement(response, expected_repeating_element, repeat_count )
241
250
242
251
:param response: Response object to check against.
243
252
:param expected_repeating_element: The expected repeating HTML element.
@@ -366,7 +375,7 @@ _assertResponse__post_builtin_tests()
366
375
367
376
.. code ::
368
377
369
- self._assertResponse__post_builtin_tests()
378
+ self._assertResponse__post_builtin_tests(*args, **kwargs )
370
379
371
380
372
381
This function is called after getting the
0 commit comments