@@ -68,7 +68,7 @@ def test_create_api_instance(self):
68
68
self .assertNotEqual (pet_api3 .api_client , swagger_client .configuration .api_client )
69
69
# customized pet api not using the old pet api's api client
70
70
self .assertNotEqual (pet_api3 .api_client , pet_api2 .api_client )
71
-
71
+
72
72
def test_async_request (self ):
73
73
self .pet_api .add_pet (body = self .pet )
74
74
@@ -110,23 +110,23 @@ def test_update_pet(self):
110
110
111
111
def test_find_pets_by_status (self ):
112
112
self .pet_api .add_pet (body = self .pet )
113
-
113
+
114
114
self .assertIn (
115
115
self .pet .id ,
116
116
list (map (lambda x : getattr (x , 'id' ), self .pet_api .find_pets_by_status (status = [self .pet .status ])))
117
117
)
118
118
119
119
def test_find_pets_by_tags (self ):
120
120
self .pet_api .add_pet (body = self .pet )
121
-
121
+
122
122
self .assertIn (
123
123
self .pet .id ,
124
124
list (map (lambda x : getattr (x , 'id' ), self .pet_api .find_pets_by_tags (tags = [self .tag .name ])))
125
125
)
126
126
127
127
def test_update_pet_with_form (self ):
128
128
self .pet_api .add_pet (body = self .pet )
129
-
129
+
130
130
name = "hello kity with form updated"
131
131
status = "pending"
132
132
self .pet_api .update_pet_with_form (pet_id = self .pet .id , name = name , status = status )
@@ -137,6 +137,7 @@ def test_update_pet_with_form(self):
137
137
self .assertEqual (status , fetched .status )
138
138
139
139
def test_upload_file (self ):
140
+ # upload file with form parameter
140
141
try :
141
142
additional_metadata = "special"
142
143
self .pet_api .upload_file (
@@ -147,10 +148,16 @@ def test_upload_file(self):
147
148
except ApiException as e :
148
149
self .fail ("upload_file() raised {0} unexpectedly" .format (type (e )))
149
150
151
+ # upload only file
152
+ try :
153
+ self .pet_api .upload_file (pet_id = self .pet .id , file = self .foo )
154
+ except ApiException as e :
155
+ self .fail ("upload_file() raised {0} unexpectedly" .format (type (e )))
156
+
150
157
def test_delete_pet (self ):
151
158
self .pet_api .add_pet (body = self .pet )
152
159
self .pet_api .delete_pet (pet_id = self .pet .id , api_key = "special-key" )
153
-
160
+
154
161
try :
155
162
self .pet_api .get_pet_by_id (pet_id = self .pet .id )
156
163
raise "expected an error"
@@ -159,8 +166,3 @@ def test_delete_pet(self):
159
166
160
167
if __name__ == '__main__' :
161
168
unittest .main ()
162
-
163
-
164
-
165
-
166
-
0 commit comments