'https://github.com/deis/deis/issues/3239'

def test_delete_domain_does_not_remove_latest(self):

    url = u'/v1/apps/{app_id}/domains'.format(app_id=self.app_id)
    test_domains = [u'test-domain.example.com', u'django.paas-sandbox']
    for domain in test_domains:
        body = {u'domain': domain}
        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)
    url = u'/v1/apps/{app_id}/domains/{domain}'.format(domain=test_domains[0], app_id=self.app_id)
    response = self.client.delete(url, content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 204)
    with self.assertRaises(Domain.DoesNotExist):
        Domain.objects.get(domain=test_domains[0])
