-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: fix transaction unit test #427
Merged
smohiudd
merged 1 commit into
chore/fix-transaction-unit-tests
from
chore/fix-fix-transaction-unit-tests
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,59 +53,59 @@ def setup( | |
self.invalid_stac_collection = invalid_stac_collection | ||
self.invalid_stac_item = invalid_stac_item | ||
|
||
def test_post_invalid_collection(self): | ||
async def test_post_invalid_collection(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the function weren't async while the |
||
""" | ||
Test the API's response to posting an invalid STAC collection. | ||
|
||
Asserts that the response status code is 422 and the detail | ||
is "Validation Error". | ||
""" | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
collections_endpoint, json=self.invalid_stac_collection | ||
) | ||
assert response.json()["detail"] == "Validation Error" | ||
assert response.status_code == 422 | ||
|
||
def test_post_valid_collection(self): | ||
async def test_post_valid_collection(self): | ||
""" | ||
Test the API's response to posting a valid STAC collection. | ||
|
||
Asserts that the response status code is 200. | ||
""" | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
collections_endpoint, json=self.valid_stac_collection | ||
) | ||
# assert response.json() == {} | ||
assert response.status_code == 200 | ||
|
||
def test_post_invalid_item(self): | ||
async def test_post_invalid_item(self): | ||
""" | ||
Test the API's response to posting an invalid STAC item. | ||
|
||
Asserts that the response status code is 422 and the detail | ||
is "Validation Error". | ||
""" | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
items_endpoint.format(self.invalid_stac_item["collection"]), | ||
json=self.invalid_stac_item, | ||
) | ||
assert response.json()["detail"] == "Validation Error" | ||
assert response.status_code == 422 | ||
|
||
def test_post_valid_item(self): | ||
async def test_post_valid_item(self): | ||
""" | ||
Test the API's response to posting a valid STAC item. | ||
|
||
Asserts that the response status code is 200. | ||
""" | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
items_endpoint.format(self.valid_stac_item["collection"]), | ||
json=self.valid_stac_item, | ||
) | ||
# assert response.json() == {} | ||
assert response.status_code == 200 | ||
|
||
def test_post_invalid_bulk_items(self): | ||
async def test_post_invalid_bulk_items(self): | ||
""" | ||
Test the API's response to posting invalid bulk STAC items. | ||
|
||
|
@@ -117,12 +117,12 @@ def test_post_invalid_bulk_items(self): | |
"items": {item_id: self.invalid_stac_item}, | ||
"method": "upsert", | ||
} | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
bulk_endpoint.format(collection_id), json=invalid_request | ||
) | ||
assert response.status_code == 422 | ||
|
||
def test_post_valid_bulk_items(self): | ||
async def test_post_valid_bulk_items(self): | ||
""" | ||
Test the API's response to posting valid bulk STAC items. | ||
|
||
|
@@ -131,7 +131,7 @@ def test_post_valid_bulk_items(self): | |
item_id = self.valid_stac_item["id"] | ||
collection_id = self.valid_stac_item["collection"] | ||
valid_request = {"items": {item_id: self.valid_stac_item}, "method": "upsert"} | ||
response = self.api_client.post( | ||
response = await self.api_client.post( | ||
bulk_endpoint.format(collection_id), json=valid_request | ||
) | ||
assert response.status_code == 200 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
using
autouse=True
will make sure the fixture is ran for each test