Commit c8afda8a authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

gh: more sleep

parent 69ad615d
Pipeline #15355 failed with stage
in 34 seconds
......@@ -153,8 +153,7 @@ class GhTests(TestCase):
'id': 1
}
}
gl_webhook = reverse('gl-webhook')
return await self.async_client.post(gl_webhook,
return await self.async_client.post(reverse('gl-webhook'),
data,
content_type='application/json',
X_FORWARDED_FOR='140.93.0.1',
......@@ -192,20 +191,21 @@ class GhTests(TestCase):
"""Test the security of the gitlab webhook."""
# Not from gitlab IP
gl_webhook = reverse('gl-webhook')
response = await self.async_client.get(gl_webhook, X_FORWARDED_FOR='5.5.5.5')
response = await self.async_client.get(reverse('gl-webhook'), X_FORWARDED_FOR='5.5.5.5')
self.assertEqual(response.status_code, 302)
# No token
response = await self.async_client.get(gl_webhook, X_FORWARDED_FOR='140.93.0.1')
response = await self.async_client.get(reverse('gl-webhook'), X_FORWARDED_FOR='140.93.0.1')
self.assertEqual(response.status_code, 302)
# Wrong token
response = await self.async_client.get(gl_webhook, X_FORWARDED_FOR='140.93.0.1', X_GITLAB_TOKEN='foo')
response = await self.async_client.get(reverse('gl-webhook'),
X_FORWARDED_FOR='140.93.0.1',
X_GITLAB_TOKEN='foo')
self.assertEqual(response.status_code, 403)
# Ping
response = await self.async_client.get(gl_webhook,
response = await self.async_client.get(reverse('gl-webhook'),
X_FORWARDED_FOR='140.93.0.1',
X_GITLAB_TOKEN=settings.GITLAB_WEBHOOK_KEY,
X_GITLAB_EVENT='ping')
......@@ -418,4 +418,5 @@ class GhTests(TestCase):
pr_login="foo",
pr_number=pr.number)
self.assertEqual(response.status_code, 200)
await sleep(15)
self.assertNotIn(f'pr/{pr.number}', [b.name for b in self.gitlab.branches.list()])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment