'Ensure that when a healthcheck fails, a backoff strategy is used before trying again.'

@mock.patch(u'requests.get', mock_status_not_found)
@mock.patch(u'api.models.get_etcd_client', (lambda func: func))
@mock.patch(u'time.sleep')
def test_app_backoff_interval(self, mock_time):

    url = u'/v1/apps/{self.app}/builds'.format(**locals())
    body = {u'image': u'autotest/example'}
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
    api.models._etcd_client = MockEtcdClient(self.app)
    url = u'/v1/apps/{self.app}/config'.format(**locals())
    body = {u'values': json.dumps({u'HEALTHCHECK_URL': u'/'})}
    return self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(mock_time.call_count, 5)
