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

Testing - CET-393 Python SDK - Label purchase error #96

Closed
wants to merge 8 commits into from

Conversation

rkeur7
Copy link
Contributor

@rkeur7 rkeur7 commented Nov 8, 2024

This WILL NOT BE merged, this was for testing purposes only.
This replicates the changes in the linked PR: https://github.com/goshippo/api-metadata-specs/pull/309 in the public api then validates by using the updated tests.

Link to ticket: https://shippo.atlassian.net/browse/CET-393
See Comments section for findings and more details.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

Tests Skipped Failures Errors Time
13 0 💤 0 ❌ 0 🔥 11.892 ⏱

Copy link

@shippo-beth shippo-beth left a comment

Choose a reason for hiding this comment

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

Just a couple suggestions and questions. Thanks for taking on adding tests and verifying the accuracy of our documentation/API!

@@ -101,7 +101,7 @@ def test_purchase_label_using_reference_ids(self, api: shippo.Shippo):
assert shipment.address_return.object_id == address_from.object_id

transaction = api.transactions.create(
TransactionCreateRequest(rate=shipment.rates[0].object_id)
TransactionCreateRequest(rate=shipment.rates[0].object_id, order=get_order_object_id(api))

Choose a reason for hiding this comment

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

is there a verification on the order here? maybe I'm missing it without looking at the whole file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

],
))

assert order is not None

Choose a reason for hiding this comment

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

could you add some verifications on the included fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Choose a reason for hiding this comment

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

can you verify that the details for the order match the order request that you passed in?

@@ -7,6 +8,7 @@

class TestCreateOrder:

@pytest.mark.run(order=1)

Choose a reason for hiding this comment

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

could you use a pytest.fixture for this instead? Could also use that to clean up the order after as well if that makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use fixture instead. I don't see an endpoint to delete an order so how would we go about cleaning the order up after?

Choose a reason for hiding this comment

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

if there isn't one available now then I guess we just leave them around :)

.github/workflows/sdk_validation.yaml Show resolved Hide resolved
],
))

assert order is not None

Choose a reason for hiding this comment

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

can you verify that the details for the order match the order request that you passed in?

@@ -100,8 +104,12 @@ def test_purchase_label_using_reference_ids(self, api: shippo.Shippo):
assert shipment.address_from.object_id == address_from.object_id
assert shipment.address_return.object_id == address_from.object_id

order_object_id = get_first_order_object_id(api)
assert order_object_id is not None
assert isinstance(order_object_id, str)

Choose a reason for hiding this comment

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

same here...is it possible to assert matching rather than just existence and type assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we really should re-factor all the tests in this repo b/c none of them verify beyond existence and type.
I am exploring automated test generation currently and trying to avoid scope creep on resolving this issue but it is something we should do. I'll open an additional ticket to tackle this larger effort.

@@ -73,4 +73,10 @@ def test_create_order(self, api: shippo.Shippo):
],
))

@pytest.mark.order(1)

Choose a reason for hiding this comment

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

can you get rid of the order marker now with the fixture?

@rkeur7
Copy link
Contributor Author

rkeur7 commented Nov 11, 2024

@shippo-beth closing this PR, I am committing these changes on the speakeasy-regen PR.
There is a lot of potential improvements to be made and I don't want to slow down patching an Open Issue by expanding the scope of this change. I will include additional work as part of the follow-up ticket.

@rkeur7 rkeur7 closed this Nov 11, 2024
@rkeur7 rkeur7 deleted the CET-393-python-sdk-label-purchase-error branch December 4, 2024 13:25
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