'Test creating a Push via the API'

def test_push_hook(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']
    body = {u'sha': u'df1e628f2244b73f9cdf944f880a2b3470a122f4', u'fingerprint': u'88:25:ed:67:56:91:3d:c6:1b:7f:42:c6:9b:41:24:80', u'receive_user': u'autotest', u'receive_repo': u'{app_id}'.format(**locals()), u'ssh_connection': u'10.0.1.10    50337    172.17.0.143    22', u'ssh_original_command': u"git-receive-pack    '{app_id}.git'".format(**locals())}
    url = u'/v1/hooks/push'.format(**locals())
    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, 403)
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)
    self.assertEqual(response.status_code, 201)
    for k in (u'owner', u'app', u'sha', u'fingerprint', u'receive_repo', u'receive_user', u'ssh_connection', u'ssh_original_command'):
        self.assertIn(k, response.data)
