def test_delete_webhook(db): instance = Webhook.create('http://www.foo.bar') assert instance.id > 0 instance.delete() assert Webhook.get(instance.id) is None assert instance.id not in Webhook.get_all_ids() assert instance.id not in Webhook.get_ids_by_type(instance.hook_type)
def test_create_webhook(db): instance = Webhook.create('http://www.foo.bar') assert instance.id > 0 assert instance.url == 'http://www.foo.bar' assert instance.hook_type == Webhook.TYPE_NORMAL assert instance.is_normal instance = Webhook.create('http://foo.foo.bar', Webhook.TYPE_UNIVERSAL) assert instance.id > 0 assert instance.url == 'http://foo.foo.bar' assert instance.hook_type == Webhook.TYPE_UNIVERSAL assert instance.id in Webhook.get_all_ids() assert instance.id in Webhook.get_ids_by_type(instance.hook_type)