def test_create_web_hook(self, client, variables): web_hook_name = self.create_random_name("testwebhook") if self.is_live: variables["web_hook_name"] = web_hook_name try: web_hook = client.create_hook( hook=WebNotificationHook(name=variables["web_hook_name"], endpoint="https://httpbin.org/post", description="my web hook", external_link="external link")) if self.is_live: variables["web_hook_id"] = web_hook.id assert web_hook.id is not None assert web_hook.name is not None assert web_hook.admins is not None assert web_hook.endpoint == "https://httpbin.org/post" assert web_hook.description == "my web hook" assert web_hook.external_link == "external link" assert web_hook.hook_type == "Webhook" finally: self.clean_up(client.delete_hook, variables, key="web_hook_id") with pytest.raises(ResourceNotFoundError): client.get_hook(variables["web_hook_id"]) return variables
def _create_web_hook_for_update(self, name): return self.admin_client.create_hook( hook=WebNotificationHook(name=name, endpoint="https://httpbin.org/post", description="my web hook", external_link="external link", username="******", password="******"))
async def create_web_hook(self, name): web_hook_name = self.create_random_name(name) if is_live(): self.variables["web_hook_name"] = web_hook_name web_hook = await self.client.create_hook( hook=WebNotificationHook(name=self.variables["web_hook_name"], endpoint="https://httpbin.org/post", description="my web hook", external_link="external link", username="******", password="******")) if is_live(): self.variables["web_hook_id"] = web_hook.id return web_hook
def test_create_web_hook(self): web_hook_name = self.create_random_name("testwebhook") try: web_hook = self.admin_client.create_hook( hook=WebNotificationHook(name=web_hook_name, endpoint="https://httpbin.org/post", description="my web hook", external_link="external link")) self.assertIsNotNone(web_hook.id) self.assertIsNotNone(web_hook.name) self.assertIsNotNone(web_hook.admin_emails) self.assertEqual(web_hook.endpoint, "https://httpbin.org/post") self.assertEqual(web_hook.description, "my web hook") self.assertEqual(web_hook.external_link, "external link") self.assertEqual(web_hook.hook_type, "Webhook") finally: self.admin_client.delete_hook(web_hook.id) with self.assertRaises(ResourceNotFoundError): self.admin_client.get_hook(web_hook.id)