'Test the text representation of a container.'

def test_container_str(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']
    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(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}/scale'.format(**locals())
    body = {u'web': 4, u'worker': 2}
    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)
    url = u'/v1/apps/{app_id}/containers'.format(**locals())
    response = self.client.get(url, HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 200)
    self.assertEqual(len(response.data[u'results']), 6)
    uuid = response.data[u'results'][0][u'uuid']
    container = Container.objects.get(uuid=uuid)
    self.assertEqual(container.short_name(), u'{}.{}.{}'.format(container.app, container.type, container.num))
    self.assertEqual(str(container), u'{}.{}.{}'.format(container.app, container.type, container.num))
