'If a user creates an application, an administrator should be able
to push builds.'

@mock.patch(u'requests.post', mock_status_ok)
def test_admin_can_create_builds_on_other_apps(self):

    user = User.objects.get(username=u'autotest2')
    token = Token.objects.get(user=user).key
    url = u'/v1/apps'
    response = self.client.post(url, HTTP_AUTHORIZATION=u'token    {}'.format(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'}
    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)
    build = Build.objects.get(uuid=response.data[u'uuid'])
    self.assertEqual(str(build), u'{}-{}'.format(response.data[u'app'], response.data[u'uuid'][:7]))
