File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ def do_GET(self):
79
79
self .send_header ('Duplicate' , 'Si!' )
80
80
self .end_headers ()
81
81
self .finish ()
82
+ elif self .path == '/set_cookie' :
83
+ self .send_response (200 , 'OK' )
84
+ self .send_header ('Set-Cookie' , 'cookie_monster=happy' )
85
+ self .wfile .write ("The cookie has been set." )
86
+ self .end_headers ()
87
+ self .finish ()
88
+ elif self .path == '/verify_cookie' :
89
+ self .send_response (200 , 'OK' )
90
+ self .end_headers ()
91
+ self .wfile .write ("<h1>Cookie verification page</h1>" )
92
+ if 'cookie_monster=happy' in self .headers .get ("Cookie" , "" ):
93
+ self .wfile .write ("Cookie Monster is happy." )
94
+ else :
95
+ self .wfile .write ("Cookie Monster is sad." )
96
+ self .finish ()
82
97
else :
83
98
self .send_error (500 )
84
99
Original file line number Diff line number Diff line change @@ -263,3 +263,26 @@ Test Duplicate Headers
263
263
Should Be Equal ${x[0]} Yes
264
264
Should Be Equal ${x[1]} Si!
265
265
266
+ Mockserver sets cookies
267
+ GET /set_cookie
268
+ Response Header Should Equal set-cookie cookie_monster=happy
269
+
270
+ No cookies should work
271
+ GET /verify_cookie
272
+ Response Body Should Contain Cookie Monster is sad
273
+
274
+ Cookies Should Work
275
+ GET /set_cookie
276
+ GET /verify_cookie
277
+
278
+ Response Body Should Contain Cookie Monster is happy
279
+
280
+ New HTTP Context should create a new cookie jar
281
+ GET /set_cookie
282
+
283
+ Create HTTP Context ${HOST}
284
+
285
+ GET /verify_cookie
286
+
287
+ Response Body Should Contain Cookie Monster is sad
288
+
You can’t perform that action at this time.
0 commit comments