-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
ef7f1e5
to
576e6d2
Compare
13c404a
to
f17cc3d
Compare
576e6d2
to
a3e7367
Compare
There was a problem hiding this 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): |
There was a problem hiding this comment.
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)
tests/test_invoices.py
Outdated
)) | ||
).subscription | ||
|
||
try: |
There was a problem hiding this comment.
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.
34ca8b2
to
433fb6d
Compare
a3e7367
to
e25e51d
Compare
e25e51d
to
0c7bf3d
Compare
No description provided.