def assert_content_type__charset_list_matches(self) -> None: response = FakeResponse( "200 OK", [("Content-Type", "text/html; charset=us-ascii")] ) with assert_succeeds(AssertionError): response.assert_content_type( "text/html", charset=["us-ascii", "utf-8", None] )
def assert_content_type__wrong_charset(self) -> None: response = FakeResponse( "200 OK", [("Content-Type", "text/html; charset=utf-8")] ) with assert_raises(AssertionError): response.assert_content_type("text/html", charset="us-ascii")
def assert_content_type__charset_not_checked(self) -> None: response = FakeResponse( "200 OK", [("Content-Type", "text/html; charset=utf-8")] ) with assert_succeeds(AssertionError): response.assert_content_type("text/html")
def assert_content_type__different(self) -> None: response = FakeResponse("200 OK", [("Content-Type", "image/png")]) with assert_raises(AssertionError): response.assert_content_type("image/jpeg")
def assert_content_type__equal(self) -> None: response = FakeResponse("200 OK", [("Content-Type", "image/png")]) with assert_succeeds(AssertionError): response.assert_content_type("image/png")
def assert_content_type__no_such_header(self) -> None: response = FakeResponse("200 OK", []) with assert_raises(AssertionError): response.assert_content_type("image/png")