Skip to content
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

feat(python-sdk): MAX-35 - test invoices - unhappy path #21

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

SebastianMiklaszewskiBldr
Copy link
Contributor

No description provided.

Copy link
Contributor

@patryk-grudzien-keen patryk-grudzien-keen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments.

self.get_subscriptions_controller().purge_subscription(subscription.id, customer.id)
self.get_customers_controller().delete_customer(customer.id)

def test_create_invoice_given_invalid_period_range_end_value_then_should_throw_exception_with_422_status_code(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_should_return_422_when_creating_invoice_with_invalid_period_range_end_value(self)

))
).subscription

try:
Copy link
Contributor

@patryk-grudzien-keen patryk-grudzien-keen Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make use of:

with pytest.raises(ErrorArrayMapResponseException) as exception_info:
            self.get_invoices_controller().create_invoice(
                subscription_id=subscription.id,
                body=CreateInvoiceRequest(CreateInvoice(
                    issue_date="2024-01-01",
                    billing_address=CreateInvoiceAddress(
                        first_name="Hilario",
                        last_name="Schmidt",
                        phone="282-329-2085",
                        address="65581 Auer Expressway",
                        zip="15217",
                        country="US",
                        city="test City",
                        state="test State"
                    ),
                    line_items=[
                        CreateInvoiceItem(
                            title="TestInvoices_Product_Name_1",
                            quantity="12",
                            unit_price="150.00",
                            description="test invoice",
                            period_range_start="2024-01-01",
                            period_range_end="2023-01-01"
                        )
                    ]
                ))
            )
exception_info.errisinstance(ErrorArrayMapResponseException)
assert 422 == exception_info.value.response_code
errors = exception_info.value.errors
assert 1 == len(errors)
assert {"line_items[0].period_range_end": ["Must be greater or equal to period_range_start."]} == errors

instead.

Base automatically changed from feat/MAX-35 to main February 2, 2024 14:16
@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr merged commit 5f847ad into main Feb 2, 2024
4 checks passed
@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr deleted the feat/MAX-35-2 branch February 2, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants