diff --git a/tests/http/mockserver.py b/tests/http/mockserver.py index 3caaafc..fe2bb8e 100755 --- a/tests/http/mockserver.py +++ b/tests/http/mockserver.py @@ -79,6 +79,21 @@ def do_GET(self): self.send_header('Duplicate', 'Si!') self.end_headers() self.finish() + elif self.path == '/set_cookie': + self.send_response(200, 'OK') + self.send_header('Set-Cookie', 'cookie_monster=happy') + self.wfile.write("The cookie has been set.") + self.end_headers() + self.finish() + elif self.path == '/verify_cookie': + self.send_response(200, 'OK') + self.end_headers() + self.wfile.write("

Cookie verification page

") + if 'cookie_monster=happy' in self.headers.get("Cookie", ""): + self.wfile.write("Cookie Monster is happy.") + else: + self.wfile.write("Cookie Monster is sad.") + self.finish() else: self.send_error(500) diff --git a/tests/http/simple.txt b/tests/http/simple.txt index c5df6a5..827950a 100644 --- a/tests/http/simple.txt +++ b/tests/http/simple.txt @@ -263,3 +263,26 @@ Test Duplicate Headers Should Be Equal ${x[0]} Yes Should Be Equal ${x[1]} Si! +Mockserver sets cookies + GET /set_cookie + Response Header Should Equal set-cookie cookie_monster=happy + +No cookies should work + GET /verify_cookie + Response Body Should Contain Cookie Monster is sad + +Cookies Should Work + GET /set_cookie + GET /verify_cookie + + Response Body Should Contain Cookie Monster is happy + +New HTTP Context should create a new cookie jar + GET /set_cookie + + Create HTTP Context ${HOST} + + GET /verify_cookie + + Response Body Should Contain Cookie Monster is sad +