def test_create_push(subscriber_client):
    subscription_path = subscriber_client.subscription_path(
        PROJECT, SUBSCRIPTION)
    try:
        subscriber_client.delete_subscription(subscription_path)
    except Exception:
        pass

    subscriber.create_push_subscription(PROJECT, TOPIC, SUBSCRIPTION, ENDPOINT)

    @eventually_consistent.call
    def _():
        assert subscriber_client.get_subscription(subscription_path)
Exemple #2
0
def test_create_push(subscriber_client):
    subscription_path = subscriber_client.subscription_path(
        PROJECT, SUBSCRIPTION)
    try:
        subscriber_client.delete_subscription(subscription_path)
    except Exception:
        pass

    subscriber.create_push_subscription(PROJECT, TOPIC, SUBSCRIPTION, ENDPOINT)

    @eventually_consistent.call
    def _():
        assert subscriber_client.get_subscription(subscription_path)
Exemple #3
0
def test_create_push(subscriber_client):
    subscription_path = subscriber_client.subscription_path(PROJECT, SUBSCRIPTION_ADMIN)
    try:
        subscriber_client.delete_subscription(subscription_path)
    except Exception:
        pass

    subscriber.create_push_subscription(PROJECT, TOPIC, SUBSCRIPTION_ADMIN, ENDPOINT)

    @backoff.on_exception(backoff.expo, AssertionError, max_time=60)
    def eventually_consistent_test():
        assert subscriber_client.get_subscription(subscription_path)

    eventually_consistent_test()
def test_create_push(subscriber_client, subscription_admin, capsys):
    # The scope of `subscription_path` is limited to this function.
    subscription_path = subscriber_client.subscription_path(
        PROJECT_ID, SUBSCRIPTION_ADMIN)
    try:
        subscriber_client.delete_subscription(
            request={"subscription": subscription_path})
    except NotFound:
        pass

    subscriber.create_push_subscription(PROJECT_ID, TOPIC, SUBSCRIPTION_ADMIN,
                                        ENDPOINT)

    out, _ = capsys.readouterr()
    assert f"{subscription_admin}" in out