|
3 | 3 | import pytest |
4 | 4 |
|
5 | 5 | import stripe |
6 | | -from tests.http_client_mock import HTTPClientMock |
7 | 6 |
|
8 | 7 |
|
9 | 8 | class TestListObject(object): |
@@ -428,57 +427,58 @@ def test_forwards_api_key_to_nested_resources(self, http_client_mock): |
428 | 427 | ) |
429 | 428 | assert lo.data[0].api_key == "sk_test_iter_forwards_options" |
430 | 429 |
|
431 | | - def test_iter_with_params(self, http_client_mock: HTTPClientMock): |
432 | | - http_client_mock.stub_request( |
433 | | - "get", |
434 | | - path="/v1/invoices/upcoming/lines", |
435 | | - query_string="customer=cus_123&expand[0]=data.price&limit=1", |
436 | | - rbody=json.dumps( |
437 | | - { |
438 | | - "object": "list", |
439 | | - "data": [ |
440 | | - { |
441 | | - "id": "prod_001", |
442 | | - "object": "product", |
443 | | - "price": {"object": "price", "id": "price_123"}, |
444 | | - } |
445 | | - ], |
446 | | - "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price", |
447 | | - "has_more": True, |
448 | | - } |
449 | | - ), |
450 | | - ) |
451 | | - # second page |
452 | | - http_client_mock.stub_request( |
453 | | - "get", |
454 | | - path="/v1/invoices/upcoming/lines", |
455 | | - query_string="customer=cus_123&expand[0]=data.price&limit=1&starting_after=prod_001", |
456 | | - rbody=json.dumps( |
457 | | - { |
458 | | - "object": "list", |
459 | | - "data": [ |
460 | | - { |
461 | | - "id": "prod_002", |
462 | | - "object": "product", |
463 | | - "price": {"object": "price", "id": "price_123"}, |
464 | | - } |
465 | | - ], |
466 | | - "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price", |
467 | | - "has_more": False, |
468 | | - } |
469 | | - ), |
470 | | - ) |
471 | | - |
472 | | - lo = stripe.Invoice.upcoming_lines( |
473 | | - api_key="sk_test_invoice_lines", |
474 | | - customer="cus_123", |
475 | | - expand=["data.price"], |
476 | | - limit=1, |
477 | | - ) |
478 | | - |
479 | | - seen = [item["id"] for item in lo.auto_paging_iter()] |
480 | | - |
481 | | - assert seen == ["prod_001", "prod_002"] |
| 430 | + # TODO(xavdid): re-add test with a new endpoint |
| 431 | + # def test_iter_with_params(self, http_client_mock: HTTPClientMock): |
| 432 | + # http_client_mock.stub_request( |
| 433 | + # "get", |
| 434 | + # path="/v1/invoices/upcoming/lines", |
| 435 | + # query_string="customer=cus_123&expand[0]=data.price&limit=1", |
| 436 | + # rbody=json.dumps( |
| 437 | + # { |
| 438 | + # "object": "list", |
| 439 | + # "data": [ |
| 440 | + # { |
| 441 | + # "id": "prod_001", |
| 442 | + # "object": "product", |
| 443 | + # "price": {"object": "price", "id": "price_123"}, |
| 444 | + # } |
| 445 | + # ], |
| 446 | + # "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price", |
| 447 | + # "has_more": True, |
| 448 | + # } |
| 449 | + # ), |
| 450 | + # ) |
| 451 | + # # second page |
| 452 | + # http_client_mock.stub_request( |
| 453 | + # "get", |
| 454 | + # path="/v1/invoices/upcoming/lines", |
| 455 | + # query_string="customer=cus_123&expand[0]=data.price&limit=1&starting_after=prod_001", |
| 456 | + # rbody=json.dumps( |
| 457 | + # { |
| 458 | + # "object": "list", |
| 459 | + # "data": [ |
| 460 | + # { |
| 461 | + # "id": "prod_002", |
| 462 | + # "object": "product", |
| 463 | + # "price": {"object": "price", "id": "price_123"}, |
| 464 | + # } |
| 465 | + # ], |
| 466 | + # "url": "/v1/invoices/upcoming/lines?customer=cus_123&expand%5B%5D=data.price", |
| 467 | + # "has_more": False, |
| 468 | + # } |
| 469 | + # ), |
| 470 | + # ) |
| 471 | + |
| 472 | + # lo = stripe.Invoice.upcoming_lines( |
| 473 | + # api_key="sk_test_invoice_lines", |
| 474 | + # customer="cus_123", |
| 475 | + # expand=["data.price"], |
| 476 | + # limit=1, |
| 477 | + # ) |
| 478 | + |
| 479 | + # seen = [item["id"] for item in lo.auto_paging_iter()] |
| 480 | + |
| 481 | + # assert seen == ["prod_001", "prod_002"] |
482 | 482 |
|
483 | 483 |
|
484 | 484 | class TestAutoPagingAsync: |
|
0 commit comments