def test_http_invalid_response_header():
 mocked_socket = mock.MagicMock()
 mocked_socket.sendall = mock.MagicMock()
 mocked_request = mock.MagicMock()
 response = Response(mocked_request, mocked_socket, None)
 with pytest.raises(InvalidHeader):
  response.start_response('200 OK', [('foo', 'essai\r\n')])
 response = Response(mocked_request, mocked_socket, None)
 with pytest.raises(InvalidHeaderName):
  response.start_response('200 OK', [('foo\r\n', 'essai')])

def test_http_invalid_response_header ( ) : mocked_socket = mock . MagicMock ( ) mocked_socket . sendall = mock . MagicMock ( ) mocked_request = mock . MagicMock ( ) response = Response ( mocked_request , mocked_socket , None ) with pytest . raises ( InvalidHeader ) : response . start_response ( '200 OK' , [ ( 'foo' , 'essai\r\n' ) ] ) response = Response ( mocked_request , mocked_socket , None ) with pytest . raises ( InvalidHeaderName ) : response . start_response ( '200 OK' , [ ( 'foo\r\n' , 'essai' ) ] )
tests whether http response headers are contains control chars .