'Test a user pushing to an unauthorized application'

def test_push_abuse(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']
    (username, password) = (u'eviluser', u'password')
    (first_name, last_name) = (u'Evil', u'User')
    email = u'evil@deis.io'
    submit = {u'username': username, u'password': password, u'first_name': first_name, u'last_name': last_name, u'email': email}
    url = u'/v1/auth/register'
    response = self.client.post(url, json.dumps(submit), content_type=u'application/json')
    self.assertEqual(response.status_code, 201)
    body = {u'sha': u'df1e628f2244b73f9cdf944f880a2b3470a122f4', u'fingerprint': u'88:25:ed:67:56:91:3d:c6:1b:7f:42:c6:9b:41:24:99', u'receive_user': u'eviluser', 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_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)
    self.assertEqual(response.status_code, 403)
