-
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 - happy path #20
Conversation
70e0a08
to
ed35a48
Compare
13c404a
to
f17cc3d
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 a couple of comments/suggestions.
tests/test_invoices.py
Outdated
|
||
|
||
class TestInvoices(TestBase): | ||
def test_create_invoice_given_subscription_given_subscription_then_return_correct_invoice(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.
Duplicated given_subscription
in the test name.
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.
What about naming this test test_should_create_invoice_for_given_subscription(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.
I am trying to apply convention what_given_then.
What we are testing
What was given
then what we expect
tests/test_invoices.py
Outdated
)) | ||
).invoice | ||
|
||
assert True == True |
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.
Please delete this assert True == True
assertion.
)) | ||
).product | ||
|
||
customer: Customer = self.get_customers_controller().create_customer( |
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.
I'd extract repeatable operations to functions and make use of them where possible.
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.
We are doing this in refactor pr
self.get_subscriptions_controller().purge_subscription(subscription.id, customer.id) | ||
self.get_customers_controller().delete_customer(customer.id) | ||
|
||
def test_void_invoice_given_invoice_then_should_be_voided(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.
Simply test_should_void_given_invoice(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.
as above
|
||
assert "voided" == response.status | ||
|
||
def test_list_invoice_events_given_voided_invoice_then_return_void_invoice_event_and_issue_invoice_event(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_list_invoice_events_for_voided_invoice(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.
as above
tests/test_invoices.py
Outdated
events = self.get_invoices_controller().list_invoice_events( | ||
{ | ||
"event_types": [InvoiceEventType.VOID_INVOICE, InvoiceEventType.ISSUE_INVOICE], | ||
"date_since": date.today() - timedelta(days=1) |
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.
It should be since_date
.
tests/test_invoices.py
Outdated
} | ||
).events | ||
|
||
assert 2 > len(events) |
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.
This assertion is not correct.
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.
Why?
f17cc3d
to
34ca8b2
Compare
34ca8b2
to
433fb6d
Compare
No description provided.