55
66import debug # pyflakes:ignore
77
8- from ietf .utils .test_data import make_test_data
98from ietf .utils .test_utils import TestCase
109
1110
1211class CookieTests (TestCase ):
1312 def test_settings_defaults (self ):
14- make_test_data ()
1513 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
1614 self .assertEqual (r .status_code , 200 )
1715 self .assertListEqual ([], r .cookies .keys ())
@@ -23,7 +21,6 @@ def test_settings_defaults(self):
2321
2422
2523 def test_settings_defaults_from_cookies (self ):
26- make_test_data ()
2724 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '7' , 'expires_soon' : 7 , 'left_menu' : 'on' , })
2825 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
2926 self .assertEqual (r .status_code , 200 )
@@ -35,7 +32,6 @@ def test_settings_defaults_from_cookies(self):
3532 self .assertEqual (q ('div a.active[href="/accounts/settings/left_menu/on"]' ).contents (), ['On' ])
3633
3734 def test_settings_values_from_cookies_garbage (self ):
38- make_test_data ()
3935 self .client .cookies = SimpleCookie ({'full_draft' : 'foo' , 'new_enough' : 'foo' , 'expires_soon' : 'foo' , 'left_menu' : 'foo' , })
4036 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
4137 self .assertEqual (r .status_code , 200 )
@@ -46,7 +42,6 @@ def test_settings_values_from_cookies_garbage(self):
4642 self .assertEqual (q ('div a.active[href="/accounts/settings/left_menu/off"]' ).contents (), ['Off' ])
4743
4844 def test_settings_values_from_cookies_random (self ):
49- make_test_data ()
5045 self .client .cookies = SimpleCookie ({'full_draft' : 'zappa' , 'new_enough' : '365' , 'expires_soon' : '5' , 'left_menu' : 'zappa' , })
5146 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
5247 self .assertEqual (r .status_code , 200 )
@@ -62,7 +57,6 @@ def test_settings_values_from_cookies_random(self):
6257# self.assertNotRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon')
6358
6459 def test_settings_values_from_cookies_1 (self ):
65- make_test_data ()
6660 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '90' , 'expires_soon' : 7 , 'left_menu' : 'off' , })
6761 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
6862 self .assertEqual (r .status_code , 200 )
@@ -77,7 +71,6 @@ def test_settings_values_from_cookies_1(self):
7771# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*7 days')
7872
7973 def test_settings_values_from_cookies_2 (self ):
80- make_test_data ()
8174 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '60' , 'expires_soon' : 14 , 'left_menu' : 'on' , })
8275 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
8376 self .assertEqual (r .status_code , 200 )
@@ -92,7 +85,6 @@ def test_settings_values_from_cookies_2(self):
9285# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*14 days')
9386
9487 def test_settings_values_from_cookies_3 (self ):
95- make_test_data ()
9688 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '30' , 'expires_soon' : 21 , 'left_menu' : 'off' })
9789 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
9890 self .assertEqual (r .status_code , 200 )
@@ -107,7 +99,6 @@ def test_settings_values_from_cookies_3(self):
10799# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*21 days')
108100
109101 def test_settings_values_from_cookies_4 (self ):
110- make_test_data ()
111102 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '21' , 'expires_soon' : 30 , 'left_menu' : 'on' , })
112103 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
113104 self .assertEqual (r .status_code , 200 )
@@ -122,7 +113,6 @@ def test_settings_values_from_cookies_4(self):
122113# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*30 days')
123114
124115 def test_settings_values_from_cookies_5 (self ):
125- make_test_data ()
126116 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '14' , 'expires_soon' : 60 , 'left_menu' : 'off' , })
127117 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
128118 self .assertEqual (r .status_code , 200 )
@@ -137,7 +127,6 @@ def test_settings_values_from_cookies_5(self):
137127# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*60 days')
138128
139129 def test_settings_values_from_cookies_6 (self ):
140- make_test_data ()
141130 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '7' , 'expires_soon' : 90 , 'left_menu' : 'on' , })
142131 r = self .client .get (urlreverse ("ietf.cookies.views.preferences" ))
143132 self .assertEqual (r .status_code , 200 )
@@ -152,7 +141,6 @@ def test_settings_values_from_cookies_6(self):
152141# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*90 days')
153142
154143 def test_full_draft (self ):
155- make_test_data ()
156144 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
157145 r = self .client .get (urlreverse ("ietf.cookies.views.full_draft" )) # no value: reset
158146 self .assertEqual (r .status_code , 200 )
@@ -167,7 +155,6 @@ def test_full_draft(self):
167155# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*14 days')
168156
169157 def test_full_draft_on (self ):
170- make_test_data ()
171158 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
172159 r = self .client .get (urlreverse ("ietf.cookies.views.full_draft" , kwargs = dict (enabled = "on" )))
173160 self .assertEqual (r .status_code , 200 )
@@ -178,7 +165,6 @@ def test_full_draft_on(self):
178165# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*full_draft.*on')
179166
180167 def test_full_draft_off (self ):
181- make_test_data ()
182168 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
183169 r = self .client .get (urlreverse ("ietf.cookies.views.full_draft" , kwargs = dict (enabled = "off" )))
184170 self .assertEqual (r .status_code , 200 )
@@ -191,7 +177,6 @@ def test_full_draft_off(self):
191177# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*full_draft.*off')
192178
193179 def test_full_draft_foo (self ):
194- make_test_data ()
195180 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
196181 r = self .client .get (urlreverse ("ietf.cookies.views.full_draft" , kwargs = dict (enabled = "foo" )))
197182 self .assertEqual (r .status_code , 200 )
@@ -203,7 +188,6 @@ def test_full_draft_foo(self):
203188# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*full_draft.*off')
204189
205190 def test_left_menu (self ):
206- make_test_data ()
207191 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 , 'left_menu' : 'on' , })
208192 r = self .client .get (urlreverse ("ietf.cookies.views.left_menu" )) # no value: reset
209193 self .assertEqual (r .status_code , 200 )
@@ -216,7 +200,6 @@ def test_left_menu(self):
216200 self .assertEqual (q ('div a.active[href="/accounts/settings/expires_soon/14"]' ).contents (), ['14 days' ])
217201
218202 def test_left_menu_on (self ):
219- make_test_data ()
220203 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 , 'left_menu' : 'off' , })
221204 r = self .client .get (urlreverse ("ietf.cookies.views.left_menu" , kwargs = dict (enabled = "on" )))
222205 self .assertEqual (r .status_code , 200 )
@@ -226,7 +209,6 @@ def test_left_menu_on(self):
226209 self .assertEqual (q ('div a.active[href="/accounts/settings/left_menu/on"]' ).contents (), ['On' ])
227210
228211 def test_left_menu_off (self ):
229- make_test_data ()
230212 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 , 'left_menu' : 'off' , })
231213 r = self .client .get (urlreverse ("ietf.cookies.views.left_menu" , kwargs = dict (enabled = "off" )))
232214 self .assertEqual (r .status_code , 200 )
@@ -236,7 +218,6 @@ def test_left_menu_off(self):
236218 self .assertEqual (q ('div a.active[href="/accounts/settings/left_menu/off"]' ).contents (), ['Off' ])
237219
238220 def test_left_menu_foo (self ):
239- make_test_data ()
240221 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 , 'left_menu' : 'off' , })
241222 r = self .client .get (urlreverse ("ietf.cookies.views.left_menu" , kwargs = dict (enabled = "foo" )))
242223 self .assertEqual (r .status_code , 200 )
@@ -245,7 +226,6 @@ def test_left_menu_foo(self):
245226 self .assertEqual (q ('div a.active[href="/accounts/settings/left_menu/off"]' ).contents (), ['Off' ])
246227
247228 def test_new_enough (self ):
248- make_test_data ()
249229 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
250230 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" )) # no value: reset
251231 self .assertEqual (r .status_code , 200 )
@@ -260,7 +240,6 @@ def test_new_enough(self):
260240# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*14 days')
261241
262242 def test_new_enough_7 (self ):
263- make_test_data ()
264243 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '14' , 'expires_soon' : 21 })
265244 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "7" )))
266245 self .assertEqual (r .status_code , 200 )
@@ -275,7 +254,6 @@ def test_new_enough_7(self):
275254# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*21 days')
276255
277256 def test_new_enough_14 (self ):
278- make_test_data ()
279257 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '7' , 'expires_soon' : 99 })
280258 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "14" )))
281259 self .assertEqual (r .status_code , 200 )
@@ -290,7 +268,6 @@ def test_new_enough_14(self):
290268# self.assertNotRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon')
291269
292270 def test_new_enough_21 (self ):
293- make_test_data ()
294271 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'new_enough' : '14' , 'expires_soon' : 90 })
295272 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "21" )))
296273 self .assertEqual (r .status_code , 200 )
@@ -305,7 +282,6 @@ def test_new_enough_21(self):
305282# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*90 days')
306283
307284 def test_new_enough_30 (self ):
308- make_test_data ()
309285 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 7 })
310286 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "30" )))
311287 self .assertEqual (r .status_code , 200 )
@@ -320,7 +296,6 @@ def test_new_enough_30(self):
320296# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*7 days')
321297
322298 def test_new_enough_60 (self ):
323- make_test_data ()
324299 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '14' , 'expires_soon' : 14 })
325300 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "60" )))
326301 self .assertEqual (r .status_code , 200 )
@@ -335,7 +310,6 @@ def test_new_enough_60(self):
335310# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*14 days')
336311
337312 def test_new_enough_90 (self ):
338- make_test_data ()
339313 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'new_enough' : '22' , 'expires_soon' : 60 })
340314 r = self .client .get (urlreverse ("ietf.cookies.views.new_enough" , kwargs = dict (days = "90" )))
341315 self .assertEqual (r .status_code , 200 )
@@ -350,7 +324,6 @@ def test_new_enough_90(self):
350324# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*expires_soon.*60 days')
351325
352326 def test_expires_soon (self ):
353- make_test_data ()
354327 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'expires_soon' : '14' , 'new_enough' : 14 })
355328 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" )) # no value: reset
356329 self .assertEqual (r .status_code , 200 )
@@ -365,7 +338,6 @@ def test_expires_soon(self):
365338# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*new_enough.*14 days')
366339
367340 def test_expires_soon_7 (self ):
368- make_test_data ()
369341 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'expires_soon' : '14' , 'new_enough' : 21 })
370342 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "7" )))
371343 self .assertEqual (r .status_code , 200 )
@@ -380,7 +352,6 @@ def test_expires_soon_7(self):
380352# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*new_enough.*21 days')
381353
382354 def test_expires_soon_14 (self ):
383- make_test_data ()
384355 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'expires_soon' : '7' , 'new_enough' : 99 })
385356 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "14" )))
386357 self .assertEqual (r .status_code , 200 )
@@ -395,7 +366,6 @@ def test_expires_soon_14(self):
395366# self.assertNotRegexpMatches(r.content, r'ietf-highlight-y.*new_enough')
396367
397368 def test_expires_soon_21 (self ):
398- make_test_data ()
399369 self .client .cookies = SimpleCookie ({'full_draft' : 'on' , 'expires_soon' : '14' , 'new_enough' : 90 })
400370 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "21" )))
401371 self .assertEqual (r .status_code , 200 )
@@ -410,7 +380,6 @@ def test_expires_soon_21(self):
410380# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*new_enough.*90 days')
411381
412382 def test_expires_soon_30 (self ):
413- make_test_data ()
414383 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'expires_soon' : '14' , 'new_enough' : 7 })
415384 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "30" )))
416385 self .assertEqual (r .status_code , 200 )
@@ -425,7 +394,6 @@ def test_expires_soon_30(self):
425394# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*new_enough.*7 days')
426395
427396 def test_expires_soon_60 (self ):
428- make_test_data ()
429397 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'expires_soon' : '14' , 'new_enough' : 14 })
430398 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "60" )))
431399 self .assertEqual (r .status_code , 200 )
@@ -440,7 +408,6 @@ def test_expires_soon_60(self):
440408# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*new_enough.*14 days')
441409
442410 def test_expires_soon_90 (self ):
443- make_test_data ()
444411 self .client .cookies = SimpleCookie ({'full_draft' : 'off' , 'expires_soon' : '22' , 'new_enough' : 60 })
445412 r = self .client .get (urlreverse ("ietf.cookies.views.expires_soon" , kwargs = dict (days = "90" )))
446413 self .assertEqual (r .status_code , 200 )
0 commit comments