99
1010class CookieTests (unittest .TestCase ):
1111
12- def setUp (self ):
13- self ._warnings_manager = check_warnings ()
14- self ._warnings_manager .__enter__ ()
15- warnings .filterwarnings ("ignore" , ".* class is insecure.*" ,
16- DeprecationWarning )
17-
18- def tearDown (self ):
19- self ._warnings_manager .__exit__ (None , None , None )
20-
2112 def test_basic (self ):
2213 cases = [
2314 {'data' : 'chips=ahoy; vienna=finger' ,
@@ -256,6 +247,9 @@ def test_setter(self):
256247 # Check output and js_output.
257248 M ['path' ] = '/foo' # Try a reserved key as well
258249 M .set (i , "%s_val" % i , "%s_coded_val" % i )
250+ self .assertEqual (M .key , i )
251+ self .assertEqual (M .value , "%s_val" % i )
252+ self .assertEqual (M .coded_value , "%s_coded_val" % i )
259253 self .assertEqual (
260254 M .output (),
261255 "Set-Cookie: %s=%s; Path=/foo" % (i , "%s_coded_val" % i ))
@@ -272,16 +266,14 @@ def test_setter(self):
272266 self .assertRaises (cookies .CookieError ,
273267 M .set , i , '%s_value' % i , '%s_value' % i )
274268
275- def test_deprecation (self ):
269+ def test_set_properties (self ):
276270 morsel = cookies .Morsel ()
277- with self .assertWarnsRegex ( DeprecationWarning , r'\bkey\b' ):
271+ with self .assertRaises ( AttributeError ):
278272 morsel .key = ''
279- with self .assertWarnsRegex ( DeprecationWarning , r'\bvalue\b' ):
273+ with self .assertRaises ( AttributeError ):
280274 morsel .value = ''
281- with self .assertWarnsRegex ( DeprecationWarning , r'\bcoded_value\b' ):
275+ with self .assertRaises ( AttributeError ):
282276 morsel .coded_value = ''
283- with self .assertWarnsRegex (DeprecationWarning , r'\bLegalChars\b' ):
284- morsel .set ('key' , 'value' , 'coded_value' , LegalChars = '.*' )
285277
286278 def test_eq (self ):
287279 base_case = ('key' , 'value' , '"value"' )
0 commit comments