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 - happy path #20

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

SebastianMiklaszewskiBldr
Copy link
Contributor

No description provided.

@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr changed the title feat(python-sdk): MAX-35 - test invoices - blocked by sdk bug feat(python-sdk): MAX-35 - test invoices - happy path - blocked by sdk bug Jan 31, 2024
@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr changed the base branch from feat/MAX-24 to main February 1, 2024 11:00
@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr changed the title feat(python-sdk): MAX-35 - test invoices - happy path - blocked by sdk bug feat(python-sdk): MAX-35 - test invoices - happy path Feb 2, 2024
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 a couple of comments/suggestions.



class TestInvoices(TestBase):
def test_create_invoice_given_subscription_given_subscription_then_return_correct_invoice(self):
Copy link
Contributor

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.

Copy link
Contributor

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)?

Copy link
Contributor Author

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

))
).invoice

assert True == True
Copy link
Contributor

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.

tests/test_invoices.py Show resolved Hide resolved
))
).product

customer: Customer = self.get_customers_controller().create_customer(
Copy link
Contributor

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.

Copy link
Contributor Author

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):
Copy link
Contributor

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).

Copy link
Contributor Author

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 Show resolved Hide resolved

assert "voided" == response.status

def test_list_invoice_events_given_voided_invoice_then_return_void_invoice_event_and_issue_invoice_event(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_list_invoice_events_for_voided_invoice(self).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as above

events = self.get_invoices_controller().list_invoice_events(
{
"event_types": [InvoiceEventType.VOID_INVOICE, InvoiceEventType.ISSUE_INVOICE],
"date_since": date.today() - timedelta(days=1)
Copy link
Contributor

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.

}
).events

assert 2 > len(events)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

@SebastianMiklaszewskiBldr SebastianMiklaszewskiBldr merged commit f864de2 into main Feb 2, 2024
4 checks passed
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