@@ -463,8 +463,9 @@ def test_tags(self):
463463 response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
464464 self .assertEqual (response .status_code , 201 )
465465 app_id = response .data ['id' ]
466- url = '/v2/apps/{app_id}/config' . format ( ** locals ())
466+
467467 # check default
468+ url = '/v2/apps/{app_id}/config' .format (** locals ())
468469 response = self .client .get (url , content_type = 'application/json' ,
469470 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
470471 self .assertEqual (response .status_code , 200 )
@@ -579,3 +580,31 @@ def test_unauthorized_user_cannot_modify_config(self):
579580 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
580581 HTTP_AUTHORIZATION = 'token {}' .format (unauthorized_token ))
581582 self .assertEqual (response .status_code , 403 )
583+
584+ def test_healthchecks (self ):
585+ """
586+ Test that healthchecks can be applied
587+ """
588+ url = '/v2/apps'
589+ response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
590+ self .assertEqual (response .status_code , 201 )
591+ app_id = response .data ['id' ]
592+
593+ # Set healthcheck URL to get defaults set
594+ body = {'values' : json .dumps ({'HEALTHCHECK_URL' : '/health' })}
595+ resp = self .client .post (
596+ '/v2/apps/{app_id}/config' .format (** locals ()),
597+ json .dumps (body ),
598+ content_type = 'application/json' ,
599+ HTTP_AUTHORIZATION = 'token {}' .format (self .token )
600+ )
601+ self .assertEqual (resp .status_code , 201 )
602+ self .assertIn ('HEALTHCHECK_URL' , resp .data ['values' ])
603+ self .assertEqual (resp .data ['values' ]['HEALTHCHECK_URL' ], '/health' )
604+
605+ # post a new build
606+ url = "/v2/apps/{app_id}/builds" .format (** locals ())
607+ body = {'image' : 'autotest/example' }
608+ response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
609+ HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
610+ self .assertEqual (response .status_code , 201 )
0 commit comments