'When a new procfile is posted which removes a certain process type, deis should stop the
existing containers.'

def test_modified_procfile_from_build_removes_containers(self):

    url = u'/v1/apps'
    response = self.client.post(url, HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
    app_id = response.data[u'id']
    build_url = u'/v1/apps/{app_id}/builds'.format(**locals())
    body = {u'image': u'autotest/example', u'sha': (u'a' * 40), u'procfile': json.dumps({u'web': u'node    server.js', u'worker': u'node    worker.js'})}
    response = self.client.post(build_url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    url = u'/v1/apps/{app_id}/scale'.format(**locals())
    body = {u'web': 4}
    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, 204)
    body = {u'image': u'autotest/example', u'sha': (u'a' * 40), u'procfile': json.dumps({u'worker': u'node    worker.js'})}
    response = self.client.post(build_url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
    self.assertEqual(Container.objects.filter(type=u'web').count(), 0)
