MCPcopy
hub / github.com/django/django / test_headers

Method test_headers

tests/httpwrappers/tests.py:1030–1041  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1028 """Headers by treating HttpResponse like a dictionary."""
1029
1030 def test_headers(self):
1031 response = HttpResponse()
1032 response["X-Foo"] = "bar"
1033 self.assertEqual(response["X-Foo"], "bar")
1034 self.assertEqual(response.headers["X-Foo"], "bar")
1035 self.assertIn("X-Foo", response)
1036 self.assertIs(response.has_header("X-Foo"), True)
1037 del response["X-Foo"]
1038 self.assertNotIn("X-Foo", response)
1039 self.assertNotIn("X-Foo", response.headers)
1040 # del doesn't raise a KeyError on nonexistent headers.
1041 del response["X-Foo"]
1042
1043 def test_headers_as_iterable_of_tuple_pairs(self):
1044 response = HttpResponse(headers=(("X-Foo", "bar"),))

Callers

nothing calls this directly

Calls 2

HttpResponseClass · 0.90
has_headerMethod · 0.80

Tested by

no test coverage detected