Beispiel #1
0
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)
Beispiel #2
0
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)