Esempio n. 1
0
 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]
         )
Esempio n. 2
0
 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")
Esempio n. 3
0
 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")
Esempio n. 4
0
 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")
Esempio n. 5
0
 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")
Esempio n. 6
0
 def assert_content_type__no_such_header(self) -> None:
     response = FakeResponse("200 OK", [])
     with assert_raises(AssertionError):
         response.assert_content_type("image/png")