Commits

Anonymous committed 2c6cb1b

Porting unit test from r2175 from trunk.

  • Participants
  • Parent commits 99844c9
  • Branches cherrypy-3.0.x

Comments (0)

Files changed (1)

cherrypy/test/test_core.py

     def testCookies(self):
         import sys
         if sys.version_info >= (2, 5):
-            self.getPage("/cookies/single?name=First",
-                         [('Cookie', 'First=Dinsdale;')])
-            self.assertHeader('Set-Cookie', 'First=Dinsdale')
-            
-            self.getPage("/cookies/multiple?names=First&names=Last",
-                         [('Cookie', 'First=Dinsdale; Last=Piranha;'),
-                          ])
-            self.assertHeader('Set-Cookie', 'First=Dinsdale')
-            self.assertHeader('Set-Cookie', 'Last=Piranha')
+            header_value = lambda x: x
         else:
-            self.getPage("/cookies/single?name=First",
-                         [('Cookie', 'First=Dinsdale;')])
-            self.assertHeader('Set-Cookie', 'First=Dinsdale;')
-            
-            self.getPage("/cookies/multiple?names=First&names=Last",
-                         [('Cookie', 'First=Dinsdale; Last=Piranha;'),
-                          ])
-            self.assertHeader('Set-Cookie', 'First=Dinsdale;')
-            self.assertHeader('Set-Cookie', 'Last=Piranha;')
+            header_value = lambda x: x+';'
+       
+        self.getPage("/cookies/single?name=First",
+                     [('Cookie', 'First=Dinsdale;')])
+        self.assertHeader('Set-Cookie', header_value('First=Dinsdale'))
+       
+        self.getPage("/cookies/multiple?names=First&names=Last",
+                     [('Cookie', 'First=Dinsdale; Last=Piranha;'),
+                      ])
+        self.assertHeader('Set-Cookie', header_value('First=Dinsdale'))
+        self.assertHeader('Set-Cookie', header_value('Last=Piranha'))
+       
+        self.getPage("/cookies/single?name=Something-With:Colon",
+            [('Cookie', 'Something-With:Colon=some-value')])
+        self.assertStatus(400)
     
     def testMaxRequestSize(self):
         self.getPage("/", headers=[('From', "x" * 500)])