@@ -56,6 +56,33 @@ def test_configuration(self):
56
56
self .assertEqual ('test_username' , client .configuration .username )
57
57
self .assertEqual ('test_password' , client .configuration .password )
58
58
59
+ def test_ignore_operation_servers (self ):
60
+ config = petstore_api .Configuration (host = HOST )
61
+ client = petstore_api .ApiClient (config )
62
+ user_api_instance = petstore_api .api .user_api .UserApi (client )
63
+
64
+ config_ignore = petstore_api .Configuration (host = HOST , ignore_operation_servers = True )
65
+ client_ignore = petstore_api .ApiClient (config_ignore )
66
+ user_api_instance_ignore = petstore_api .api .user_api .UserApi (client_ignore )
67
+
68
+ params_to_serialize = {
69
+ 'user' : petstore_api .User (id = 1 , username = 'test' ),
70
+ '_request_auth' : None ,
71
+ '_content_type' : 'application/json' ,
72
+ '_headers' : None ,
73
+ '_host_index' : 0
74
+ }
75
+
76
+ # operation servers should be used
77
+ _ , url , * _ = user_api_instance ._create_user_serialize (** params_to_serialize )
78
+ self .assertEqual (client .configuration .host , HOST )
79
+ self .assertEqual (url , 'http://petstore.swagger.io/v2/user' )
80
+
81
+ # operation servers should be ignored
82
+ _ , url_ignore , * _ = user_api_instance_ignore ._create_user_serialize (** params_to_serialize )
83
+ self .assertEqual (client .configuration .host , HOST )
84
+ self .assertEqual (url_ignore , HOST + '/user' )
85
+
59
86
def test_select_header_accept (self ):
60
87
accepts = ['APPLICATION/JSON' , 'APPLICATION/XML' ]
61
88
accept = self .api_client .select_header_accept (accepts )
0 commit comments