Ejemplo n.º 1
0
 def test_response_headers_regex(self):
     handler = handlers.HeadersResponseHandler(self.test_class)
     self.test.test_data = {
         'response_headers': {
             'content-type': '/text/plain/',
         }
     }
     self.test.response = {'content-type': 'text/plain; charset=UTF-8'}
     self._assert_handler(handler)
Ejemplo n.º 2
0
 def test_response_headers(self):
     handler = handlers.HeadersResponseHandler(self.test_class)
     self.test.test_data = {
         'response_headers': {
             'content-type': 'text/plain',
         }
     }
     self.test.response = {'content-type': 'text/plain'}
     self._assert_handler(handler)
Ejemplo n.º 3
0
 def test_response_headers_fail_header(self):
     handler = handlers.HeadersResponseHandler(self.test_class)
     self.test.test_data = {
         'response_headers': {
             'location': '/somewhere',
         }
     }
     self.test.response = {'content-type': 'application/json'}
     with self.assertRaises(AssertionError) as failure:
         self._assert_handler(handler)
     self.assertIn("'location' header not present in response:",
                   str(failure.exception))
Ejemplo n.º 4
0
 def test_response_headers_fail_data(self):
     handler = handlers.HeadersResponseHandler(self.test_class)
     self.test.test_data = {
         'response_headers': {
             'content-type': 'text/plain',
         }
     }
     self.test.response = {'content-type': 'application/json'}
     with self.assertRaises(AssertionError) as failure:
         self._assert_handler(handler)
     self.assertIn(
         "Expect header content-type with value text/plain,"
         " got application/json", str(failure.exception))