-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
|
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.
Just a couple suggestions and questions. Thanks for taking on adding tests and verifying the accuracy of our documentation/API!
tests/test_purchase_label.py
Outdated
@@ -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)) |
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.
is there a verification on the order here? maybe I'm missing it without looking at the whole file
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.
Updated
], | ||
)) | ||
|
||
assert order is not None |
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.
could you add some verifications on the included fields?
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.
Updated.
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.
can you verify that the details for the order match the order request that you passed in?
tests/test_create_order.py
Outdated
@@ -7,6 +8,7 @@ | |||
|
|||
class TestCreateOrder: | |||
|
|||
@pytest.mark.run(order=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.
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.
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.
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?
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.
if there isn't one available now then I guess we just leave them around :)
], | ||
)) | ||
|
||
assert order is not None |
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.
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) |
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.
same here...is it possible to assert matching rather than just existence and type assertion?
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.
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) |
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.
can you get rid of the order marker now with the fixture?
@shippo-beth closing this PR, I am committing these changes on the speakeasy-regen PR. |
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.