@@ -52,20 +52,20 @@ def test_app(self, mock_requests):
5252 """
5353 url = '/v2/apps'
5454 response = self .client .post (url )
55- self .assertEqual (response .status_code , 201 )
55+ self .assertEqual (response .status_code , 201 , response . data )
5656 app_id = response .data ['id' ] # noqa
5757 self .assertIn ('id' , response .data )
5858 response = self .client .get ('/v2/apps' )
59- self .assertEqual (response .status_code , 200 )
59+ self .assertEqual (response .status_code , 200 , response . data )
6060 self .assertEqual (len (response .data ['results' ]), 1 )
6161 url = '/v2/apps/{app_id}' .format (** locals ())
6262 response = self .client .get (url )
63- self .assertEqual (response .status_code , 200 )
63+ self .assertEqual (response .status_code , 200 , response . data )
6464 body = {'id' : 'new' }
6565 response = self .client .patch (url , body )
66- self .assertEqual (response .status_code , 405 )
66+ self .assertEqual (response .status_code , 405 , response . content )
6767 response = self .client .delete (url )
68- self .assertEqual (response .status_code , 204 )
68+ self .assertEqual (response .status_code , 204 , response . data )
6969
7070 def test_response_data (self , mock_requests ):
7171 """Test that the serialized response contains only relevant data."""
@@ -83,7 +83,7 @@ def test_response_data(self, mock_requests):
8383 def test_app_override_id (self , mock_requests ):
8484 body = {'id' : 'myid' }
8585 response = self .client .post ('/v2/apps' , body )
86- self .assertEqual (response .status_code , 201 )
86+ self .assertEqual (response .status_code , 201 , response . data )
8787 body = {'id' : response .data ['id' ]}
8888 response = self .client .post ('/v2/apps' , body )
8989 self .assertContains (response , 'App with this id already exists.' , status_code = 400 )
@@ -94,7 +94,7 @@ def test_app_actions(self, mock_requests, mock_get):
9494 url = '/v2/apps'
9595 body = {'id' : 'autotest' }
9696 response = self .client .post (url , body )
97- self .assertEqual (response .status_code , 201 )
97+ self .assertEqual (response .status_code , 201 , response . data )
9898 app_id = response .data ['id' ] # noqa
9999
100100 # test logs - 204 from deis-logger
@@ -103,12 +103,12 @@ def test_app_actions(self, mock_requests, mock_get):
103103 mock_get .return_value = mock_response
104104 url = "/v2/apps/{app_id}/logs" .format (** locals ())
105105 response = self .client .get (url )
106- self .assertEqual (response .status_code , 204 )
106+ self .assertEqual (response .status_code , 204 , response . content )
107107
108108 # test logs - 404 from deis-logger
109109 mock_response .status_code = 404
110110 response = self .client .get (url )
111- self .assertEqual (response .status_code , 204 )
111+ self .assertEqual (response .status_code , 204 , response . content )
112112
113113 # test logs - unanticipated status code from deis-logger
114114 mock_response .status_code = 400
@@ -140,7 +140,7 @@ def test_app_release_notes_in_logs(self, mock_requests, mock_logger):
140140 url = '/v2/apps'
141141 body = {'id' : 'autotest' }
142142 response = self .client .post (url , body )
143- self .assertEqual (response .status_code , 201 )
143+ self .assertEqual (response .status_code , 201 , response . data )
144144 # check app logs
145145 exp_msg = "autotest created initial release"
146146 exp_log_call = mock .call (logging .INFO , exp_msg )
@@ -159,11 +159,11 @@ def test_app_errors(self, mock_requests):
159159 url = '/v2/apps'
160160 body = {'id' : app_id }
161161 response = self .client .post (url , body )
162- self .assertEqual (response .status_code , 201 )
162+ self .assertEqual (response .status_code , 201 , response . data )
163163 app_id = response .data ['id' ] # noqa
164164 url = '/v2/apps/{app_id}' .format (** locals ())
165165 response = self .client .delete (url )
166- self .assertEqual (response .status_code , 204 )
166+ self .assertEqual (response .status_code , 204 , response . data )
167167 for endpoint in ('containers' , 'config' , 'releases' , 'builds' ):
168168 url = '/v2/apps/{app_id}/{endpoint}' .format (** locals ())
169169 response = self .client .get (url )
@@ -186,7 +186,7 @@ def test_app_structure_is_valid_json(self, mock_requests):
186186 """Application structures should be valid JSON objects."""
187187 url = '/v2/apps'
188188 response = self .client .post (url )
189- self .assertEqual (response .status_code , 201 )
189+ self .assertEqual (response .status_code , 201 , response . data )
190190 app_id = response .data ['id' ]
191191 self .assertIn ('structure' , response .data )
192192 self .assertEqual (response .data ['structure' ], {})
@@ -215,7 +215,7 @@ def test_admin_can_manage_other_apps(self, mock_requests, mock_logger):
215215 self .client .credentials (HTTP_AUTHORIZATION = 'Token ' + self .token )
216216 url = '/v2/apps/{}' .format (app_id )
217217 response = self .client .get (url )
218- self .assertEqual (response .status_code , 200 )
218+ self .assertEqual (response .status_code , 200 , response . data )
219219 # check app logs
220220 exp_msg = "autotest2 created initial release"
221221 exp_log_call = mock .call (logging .INFO , exp_msg )
@@ -225,7 +225,7 @@ def test_admin_can_manage_other_apps(self, mock_requests, mock_logger):
225225 # delete the app
226226 url = '/v2/apps/{}' .format (app_id )
227227 response = self .client .delete (url )
228- self .assertEqual (response .status_code , 204 )
228+ self .assertEqual (response .status_code , 204 , response . data )
229229
230230 def test_admin_can_see_other_apps (self , mock_requests ):
231231 """If a user creates an application, the administrator should be able
@@ -257,7 +257,7 @@ def test_run_without_release_should_error(self, mock_requests):
257257 url = '/v2/apps/{}/run' .format (app_id )
258258 body = {'command' : 'ls -al' }
259259 response = self .client .post (url , body )
260- self .assertEqual (response .status_code , 400 )
260+ self .assertEqual (response .status_code , 400 , response . data )
261261 self .assertEqual (response .data , {'detail' : 'No build associated with this '
262262 'release to run this command' })
263263
@@ -275,13 +275,13 @@ def test_run(self, mock_requests):
275275 body = {'image' : 'autotest/example' }
276276 url = '/v2/apps/{app_id}/builds' .format (** locals ())
277277 response = self .client .post (url , body )
278- self .assertEqual (response .status_code , 201 )
278+ self .assertEqual (response .status_code , 201 , response . data )
279279
280280 # run command
281281 url = '/v2/apps/{}/run' .format (app_id )
282282 body = {'command' : 'ls -al' }
283283 response = self .client .post (url , body )
284- self .assertEqual (response .status_code , 200 )
284+ self .assertEqual (response .status_code , 200 , response . data )
285285 self .assertEqual (response .data ['rc' ], 0 )
286286 self .assertEqual (response .data ['output' ], 'mock' )
287287
@@ -294,15 +294,15 @@ def test_run_failure(self, mock_requests):
294294 body = {'image' : 'autotest/example' }
295295 url = '/v2/apps/{app_id}/builds' .format (** locals ())
296296 response = self .client .post (url , body )
297- self .assertEqual (response .status_code , 201 )
297+ self .assertEqual (response .status_code , 201 , response . data )
298298
299299 with mock .patch ('scheduler.KubeHTTPClient.run' ) as kube_run :
300300 kube_run .side_effect = KubeException ('boom!' )
301301 # run command
302302 url = '/v2/apps/{}/run' .format (app_id )
303303 body = {'command' : 'ls -al' }
304304 response = self .client .post (url , body )
305- self .assertEqual (response .status_code , 503 )
305+ self .assertEqual (response .status_code , 503 , response . data )
306306
307307 def test_unauthorized_user_cannot_see_app (self , mock_requests ):
308308 """
@@ -360,7 +360,7 @@ def test_app_transfer(self, mock_requests):
360360 new_owner_token = Token .objects .get (user = new_owner ).key
361361 body = {'owner' : new_owner .username }
362362 response = self .client .post (url , body )
363- self .assertEqual (response .status_code , 200 )
363+ self .assertEqual (response .status_code , 200 , response . data )
364364
365365 # Original user can no longer access it
366366 response = self .client .get (url )
@@ -369,14 +369,14 @@ def test_app_transfer(self, mock_requests):
369369 # New owner can access it
370370 self .client .credentials (HTTP_AUTHORIZATION = 'Token ' + new_owner_token )
371371 response = self .client .get (url )
372- self .assertEqual (response .status_code , 200 )
372+ self .assertEqual (response .status_code , 200 , response . data )
373373 self .assertEqual (response .data ['owner' ], new_owner .username )
374374
375375 # Collaborators can't transfer
376376 body = {'username' : owner .username }
377377 perms_url = url + "/perms/"
378378 response = self .client .post (perms_url , body )
379- self .assertEqual (response .status_code , 201 )
379+ self .assertEqual (response .status_code , 201 , response . data )
380380
381381 self .client .credentials (HTTP_AUTHORIZATION = 'Token ' + owner_token )
382382 body = {'owner' : self .user .username }
@@ -387,9 +387,9 @@ def test_app_transfer(self, mock_requests):
387387 self .client .credentials (HTTP_AUTHORIZATION = 'Token ' + self .token )
388388 body = {'owner' : self .user .username }
389389 response = self .client .post (url , body )
390- self .assertEqual (response .status_code , 200 )
390+ self .assertEqual (response .status_code , 200 , response . data )
391391 response = self .client .get (url )
392- self .assertEqual (response .status_code , 200 )
392+ self .assertEqual (response .status_code , 200 , response . data )
393393 self .assertEqual (response .data ['owner' ], self .user .username )
394394
395395 def test_app_exists_in_kubernetes (self , mock_requests ):
@@ -411,7 +411,7 @@ def test_app_create_failure_kubernetes_create(self, mock_requests):
411411 with mock .patch ('scheduler.KubeHTTPClient.create' ) as mock_kube :
412412 mock_kube .side_effect = KubeException ('Boom!' )
413413 response = self .client .post ('/v2/apps' , {'id' : 'test-kube' })
414- self .assertEqual (response .status_code , 503 )
414+ self .assertEqual (response .status_code , 503 , response . data )
415415
416416 def test_app_delete_failure_kubernetes_destroy (self , mock_requests ):
417417 """
@@ -420,13 +420,13 @@ def test_app_delete_failure_kubernetes_destroy(self, mock_requests):
420420 """
421421 # create
422422 response = self .client .post ('/v2/apps' , {'id' : 'test' })
423- self .assertEqual (response .status_code , 201 )
423+ self .assertEqual (response .status_code , 201 , response . data )
424424
425425 with mock .patch ('scheduler.KubeHTTPClient.destroy' ) as mock_kube :
426426 # delete
427427 mock_kube .side_effect = KubeException ('Boom!' )
428428 response = self .client .delete ('/v2/apps/test' )
429- self .assertEqual (response .status_code , 503 )
429+ self .assertEqual (response .status_code , 503 , response . data )
430430
431431 def test_app_verify_application_health_success (self , mock_requests ):
432432 """
@@ -447,13 +447,13 @@ def test_app_verify_application_health_success(self, mock_requests):
447447 # create app
448448 body = {'id' : 'myid' }
449449 response = self .client .post ('/v2/apps' , body )
450- self .assertEqual (response .status_code , 201 )
450+ self .assertEqual (response .status_code , 201 , response . data )
451451
452452 # deploy app to get verification
453453 url = "/v2/apps/myid/builds"
454454 body = {'image' : 'autotest/example' }
455455 response = self .client .post (url , body )
456- self .assertEqual (response .status_code , 201 )
456+ self .assertEqual (response .status_code , 201 , response . data )
457457 self .assertEqual (response .data ['image' ], body ['image' ])
458458
459459 self .assertEqual (mr .called , True )
@@ -483,13 +483,13 @@ def test_app_verify_application_health_failure_404(self, mock_requests):
483483 # create app
484484 body = {'id' : 'myid' }
485485 response = self .client .post ('/v2/apps' , body )
486- self .assertEqual (response .status_code , 201 )
486+ self .assertEqual (response .status_code , 201 , response . data )
487487
488488 # deploy app to get verification
489489 url = "/v2/apps/myid/builds"
490490 body = {'image' : 'autotest/example' }
491491 response = self .client .post (url , body )
492- self .assertEqual (response .status_code , 201 )
492+ self .assertEqual (response .status_code , 201 , response . data )
493493 self .assertEqual (response .data ['image' ], body ['image' ])
494494
495495 self .assertEqual (mr .called , True )
@@ -510,13 +510,13 @@ def _raise_exception(request, ctx):
510510 # create app
511511 body = {'id' : 'myid' }
512512 response = self .client .post ('/v2/apps' , body )
513- self .assertEqual (response .status_code , 201 )
513+ self .assertEqual (response .status_code , 201 , response . data )
514514
515515 # deploy app to get verification
516516 url = "/v2/apps/myid/builds"
517517 body = {'image' : 'autotest/example' }
518518 response = self .client .post (url , body )
519- self .assertEqual (response .status_code , 201 )
519+ self .assertEqual (response .status_code , 201 , response . data )
520520 self .assertEqual (response .data ['image' ], body ['image' ])
521521
522522 # Called 10 times due to the exception
0 commit comments