8000 remove test using soon-to-be-gone endpoint by xavdid-stripe · Pull Request #1468 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

remove test using soon-to-be-gone endpoint #1468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions tests/api_resources/test_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ def test_can_send_invoice_classmethod(self, http_client_mock):
)
assert isinstance(resource, stripe.Invoice)

def test_can_upcoming(self, http_client_mock):
resource = stripe.Invoice.upcoming(customer="cus_123")
http_client_mock.assert_requested("get", path="/v1/invoices/upcoming")
assert isinstance(resource, stripe.Invoice)

def test_can_void_invoice(self, http_client_mock):
resource = stripe.Invoice.retrieve(TEST_RESOURCE_ID)
resource = resource.void_invoice()
Expand Down
104 changes: 52 additions & 52 deletions tests/api_resources/test_list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pytest

import stripe
from tests.http_client_mock import HTTPClientMock


class TestListObject(object):
Expand Down Expand Up @@ -440,57 +439,58 @@ def test_forwards_api_key_to_nested_resources(self, http_client_mock):
)
assert lo.data[0].api_key == "sk_test_iter_forwards_options"

def test_iter_with_params(self, http_client_mock: HTTPClientMock):
http_client_mock.stub_request(
"get",
path="/v1/invoices/upcoming/lines",
query_string="customer=cus_123&expand[0]=data.price&limit=1",
rbody=json.dumps(
{
"object": "list",
"data": [
{
"id": "prod_001",
"object": "product",
"price": {"object": "price", "id": "price_123"},
}
],
"url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price",
"has_more": True,
}
),
)
# second page
http_client_mock.stub_request(
"get",
path="/v1/invoices/upcoming/lines",
query_string="customer=cus_123&expand[0]=data.price&limit=1&starting_after=prod_001",
rbody=json.dumps(
{
"object": "list",
"data": [
{
"id": "prod_002",
"object": "product",
"price": {"object": "price", "id": "price_123"},
}
],
"url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price",
"has_more": False,
}
),
)

lo = stripe.Invoice.upcoming_lines(
api_key="sk_test_invoice_lines",
customer="cus_123",
expand=["data.price"],
limit=1,
)

seen = [item["id"] for item in lo.auto_paging_iter()]

assert seen == ["prod_001", "prod_002"]
# TODO(xavdid): re-add test with a new endpoint
# def test_iter_with_params(self, http_client_mock: HTTPClientMock):
# http_client_mock.stub_request(
# "get",
# path="/v1/invoices/upcoming/lines",
# query_string="customer=cus_123&expand[0]=data.price&limit=1",
# rbody=json.dumps(
# {
# "object": "list",
# "data": [
# {
# "id": "prod_001",
# "object": "product",
# "price": {"object": "price", "id": "price_123"},
# }
# ],
# "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price",
# "has_more": True,
# }
# ),
# )
# # second page
# http_client_mock.stub_request(
# "get",
# path="/v1/invoices/upcoming/lines",
# query_string="customer=cus_123&expand[0]=data.price&limit=1&starting_after=prod_001",
# rbody=json.dumps(
# {
# "object": "list",
# "data": [
# {
# "id": "prod_002",
# "object": "product",
# "price": {"object": "price", "id": "price_123"},
# }
# ],
# "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price",
# "has_more": False,
# }
# ),
# )

# lo = stripe.Invoice.upcoming_lines(
# api_key="sk_test_invoice_lines",
# customer="cus_123",
# expand=["data.price"],
# limit=1,
# )

# seen = [item["id"] for item in lo.auto_paging_iter()]

# assert seen == ["prod_001", "prod_002"]


class TestAutoPagingAsync:
Expand Down
Loading
0