Exemplo n.º 1
0
def test_get_subscriptions_list_information():
    global ids
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # Generate subscriptions
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ids = {
        do_create_subscription(recurrings, plan_id=do_create_plan(recurrings))
        for _ in range(0, 3)
    }

    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # Fetch subscriptions
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    response = recurrings.get_subscriptions(request_id=str(uuid.uuid4()),
                                            max_count=50,
                                            sort_order="desc")

    print("\ncount: %s" % len(response.data))

    for s in response.data:
        print("%s %s: %s %s" % (s.created, s.id, s.currency, s.status))
        if s.status != s.Status.CANCELLED:
            do_cancel_subscription(recurrings, s.id)

    assert ids.issubset({s.id for s in response.data})
Exemplo n.º 2
0
def teardown_function():
    global subscription_id
    do_cancel_subscription(
        recurrings, subscription_id) if subscription_id is not None else None
Exemplo n.º 3
0
def teardown_function():
    global ids
    for id in ids:
        do_cancel_subscription(recurrings, id)