def assert_set_cookie__invalid_max_age(self) -> None: response = FakeResponse( "200 OK", [("Set-Cookie", "Foo=Bar; Max-Age=INVALID")] ) with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar") with assert_raises(AssertionError): response.assert_set_cookie("Foo", "Bar", max_age=1234)
def assert_set_cookie__no_http_only(self) -> None: response = FakeResponse("200 OK", [("Set-Cookie", "Foo=Bar")]) with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar") with assert_raises(AssertionError): response.assert_set_cookie("Foo", "Bar", http_only=True) with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar", http_only=False)
def assert_set_cookie__has_secure(self) -> None: response = FakeResponse("200 OK", [("Set-Cookie", "Foo=Bar; Secure")]) with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar") with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar", secure=True) with assert_raises(AssertionError): response.assert_set_cookie("Foo", "Bar", secure=False)
def assert_set_cookie__wrong_value(self) -> None: response = FakeResponse("200 OK", [("Set-Cookie", "Foo=Wrong")]) with assert_raises(AssertionError): response.assert_set_cookie("Foo", "Bar")
def assert_set_cookie__no_cookie_header(self) -> None: response = FakeResponse("200 OK", []) with assert_raises(AssertionError): response.assert_set_cookie("Foo", "Bar")
def assert_set_cookie__simple_match(self) -> None: response = FakeResponse( "200 OK", [("Set-Cookie", "Foo=Bar; Secure; Max-Age=1234")] ) with assert_succeeds(AssertionError): response.assert_set_cookie("Foo", "Bar")