<s> """<STR_LIT>""" <EOL> import httpretty <EOL> from six . moves import cStringIO <EOL> from six . moves . urllib import parse as urlparse <EOL> from bravado . client import SwaggerClient <EOL> from tests . functional . conftest import register_spec , API_DOCS_URL , register_get <EOL> def test_form_params_in_request ( httprettified , swagger_dict ) : <EOL> param1_spec = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT>" <EOL> } <EOL> param2_spec = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT:string>" <EOL> } <EOL> path_spec = swagger_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> path_spec [ '<STR_LIT>' ] = path_spec . pop ( '<STR_LIT>' ) <EOL> path_spec [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ param1_spec , param2_spec ] <EOL> register_spec ( swagger_dict ) <EOL> httpretty . register_uri ( httpretty . POST , "<STR_LIT>" ) <EOL> resource = SwaggerClient . from_url ( API_DOCS_URL ) . api_test <EOL> resource . testHTTP ( param_id = <NUM_LIT> , param_name = '<STR_LIT:foo>' ) . result ( ) <EOL> content_type = httpretty . last_request ( ) . headers [ '<STR_LIT>' ] <EOL> assert '<STR_LIT>' == content_type <EOL> body = urlparse . parse_qs ( httpretty . last_request ( ) . body ) <EOL> assert { b'<STR_LIT>' : [ b'<STR_LIT:foo>' ] , b'<STR_LIT>' : [ b'<STR_LIT>' ] } == body <EOL> def test_file_upload_in_request ( httprettified , swagger_dict ) : <EOL> param1_spec = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT>" <EOL> } <EOL> param2_spec = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT:file>" <EOL> } <EOL> path_spec = swagger_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> path_spec [ '<STR_LIT>' ] = path_spec . pop ( '<STR_LIT>' ) <EOL> path_spec [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ param1_spec , param2_spec ] <EOL> path_spec [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> register_spec ( swagger_dict ) <EOL> httpretty . register_uri ( httpretty . POST , "<STR_LIT>" ) <EOL> resource = SwaggerClient . from_url ( API_DOCS_URL ) . api_test <EOL> resource . testHTTP ( param_id = <NUM_LIT> , file_name = cStringIO ( '<STR_LIT>' ) ) . result ( ) <EOL> content_type = httpretty . last_request ( ) . headers [ '<STR_LIT>' ] <EOL> assert content_type . startswith ( '<STR_LIT>' ) <EOL> assert b"<STR_LIT>" in httpretty . last_request ( ) . body <EOL> assert b"<STR_LIT>" in httpretty . last_request ( ) . body <EOL> def test_parameter_in_path_of_request ( httprettified , swagger_dict ) : <EOL> path_param_spec = { <EOL> "<STR_LIT>" : "<STR_LIT:path>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT:string>" <EOL> } <EOL> paths_spec = swagger_dict [ '<STR_LIT>' ] <EOL> paths_spec [ '<STR_LIT>' ] = paths_spec . pop ( '<STR_LIT>' ) <EOL> paths_spec [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( <EOL> path_param_spec ) <EOL> register_spec ( swagger_dict ) <EOL> register_get ( '<STR_LIT>' ) <EOL> resource = SwaggerClient . from_url ( API_DOCS_URL ) . api_test <EOL> assert resource . testHTTP ( test_param = "<STR_LIT:foo>" , param_id = "<STR_LIT>" ) . result ( ) is None <EOL> def test_default_value_not_in_request ( httprettified , swagger_dict ) : <EOL> swagger_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT:default>' ] = '<STR_LIT:X>' <EOL> register_spec ( swagger_dict ) <EOL> register_get ( "<STR_LIT>" ) <EOL> resource = SwaggerClient . from_url ( API_DOCS_URL ) . api_test <EOL> resource . testHTTP ( ) . result ( ) <EOL> assert '<STR_LIT>' not in httpretty . last_request ( ) . querystring <EOL> def test_array_with_collection_format_in_path_of_request ( <EOL> httprettified , swagger_dict ) : <EOL> path_param_spec = { <EOL> '<STR_LIT>' : '<STR_LIT:path>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:type>' : '<STR_LIT>' <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> swagger_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] = swagger_dict [ '<STR_LIT>' ] . pop ( '<STR_LIT>' ) <EOL> swagger_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ path_param_spec ] <EOL> register_spec ( swagger_dict ) <EOL> register_get ( '<STR_LIT>' ) <EOL> resource = SwaggerClient . from_url ( API_DOCS_URL ) . api_test <EOL> assert resource . testHTTP ( param_ids = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) . result ( ) is None </s>
