#NEWLINE# @ pytest . fixture #NEWLINE# def mock_protocol( request_uri ) : #NEWLINE# #INDENT# from urllib.parse import unquote , urlparse , parse_qs #NEWLINE# mock_app = MockApp ( ) #NEWLINE# protocol = MockProtocol ( ) ( mock_app ) #NEWLINE# protocol . loop = None #NEWLINE# protocol . headers = None #NEWLINE# protocol . http_application = mock_app #NEWLINE# protocol . socket . getpeername . return_value = [ '' , '' ] #NEWLINE# parsed_url = urlparse ( request_uri ) #NEWLINE# protocol . path = unquote ( parsed_url . path ) #NEWLINE# protocol . query = parse_qs ( parsed_url . query ) #NEWLINE# return protocol