Exemplo n.º 1
0
def test_value_error_is_raised_if_source_decorator_was_used_without_argument():
    async def source(*_):
        yield "test"  # pragma: no cover

    subscription = SubscriptionType()
    with pytest.raises(ValueError):
        subscription.source(source)
Exemplo n.º 2
0
def test_field_source_can_be_set_using_decorator(schema):
    async def source(*_):
        yield "test"  # pragma: no cover

    subscription = SubscriptionType()
    subscription.source("message")(source)
    subscription.bind_to_schema(schema)
    field = schema.type_map.get("Subscription").fields["message"]
    assert field.subscribe is source
Exemplo n.º 3
0
def subscriptions():
    subs = SubscriptionType()
    subs.source("ping")(ping)
    return subs