Skip to content

Commit 5a1e78f

Browse files
update lock file and fix tests (#892)
1 parent 2e2b0f9 commit 5a1e78f

3 files changed

Lines changed: 433 additions & 394 deletions

File tree

‎stac_fastapi/extensions/tests/test_aggregation.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_post_aggregations(client: TestClient) -> None:
121121

122122

123123
def test_post_aggregate(client: TestClient) -> None:
124-
response = client.post("/aggregate", content="{}")
124+
response = client.post("/aggregate", json={})
125125
assert response.is_success, response.text
126126
assert response.json()["aggregations"] == []
127127
assert AggregationCollection(

‎stac_fastapi/extensions/tests/test_transaction.py‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
from typing import Iterator, List, Union
32

43
import pytest
@@ -99,25 +98,21 @@ def delete_collection(self, collection_id: str, **kwargs):
9998

10099

101100
def test_create_item(client: TestClient, item: Item) -> None:
102-
response = client.post("/collections/a-collection/items", content=json.dumps(item))
101+
response = client.post("/collections/a-collection/items", json=item)
103102
assert response.is_success, response.text
104103
assert response.json()["type"] == "Feature"
105104

106105

107106
def test_create_item_collection(
108107
client: TestClient, item_collection: ItemCollection
109108
) -> None:
110-
response = client.post(
111-
"/collections/a-collection/items", content=json.dumps(item_collection)
112-
)
109+
response = client.post("/collections/a-collection/items", json=item_collection)
113110
assert response.is_success, response.text
114111
assert response.json()["type"] == "FeatureCollection"
115112

116113

117114
def test_update_item(client: TestClient, item: Item) -> None:
118-
response = client.put(
119-
"/collections/a-collection/items/an-item", content=json.dumps(item)
120-
)
115+
response = client.put("/collections/a-collection/items/an-item", json=item)
121116
assert response.is_success, response.text
122117
assert response.json()["path_collection_id"] == "a-collection"
123118
assert response.json()["path_item_id"] == "an-item"
@@ -127,7 +122,7 @@ def test_update_item(client: TestClient, item: Item) -> None:
127122
def test_patch_operation_item(client: TestClient) -> None:
128123
response = client.patch(
129124
"/collections/a-collection/items/an-item",
130-
content='[{"op": "add", "path": "/properties/foo", "value": "bar"}]',
125+
json=[{"op": "add", "path": "/properties/foo", "value": "bar"}],
131126
)
132127
assert response.is_success, response.text
133128
assert response.json()["path_collection_id"] == "a-collection"
@@ -140,7 +135,7 @@ def test_patch_operation_item(client: TestClient) -> None:
140135
def test_patch_merge_item(client: TestClient) -> None:
141136
response = client.patch(
142137
"/collections/a-collection/items/an-item",
143-
content=json.dumps({"properties": {"hello": "world", "foo": None}}),
138+
json={"properties": {"hello": "world", "foo": None}},
144139
)
145140
assert response.is_success, response.text
146141
assert response.json()["path_collection_id"] == "a-collection"
@@ -159,13 +154,13 @@ def test_delete_item(client: TestClient) -> None:
159154

160155

161156
def test_create_collection(client: TestClient, collection: Collection) -> None:
162-
response = client.post("/collections", content=json.dumps(collection))
157+
response = client.post("/collections", json=collection)
163158
assert response.is_success, response.text
164159
assert response.json()["type"] == "Collection"
165160

166161

167162
def test_update_collection(client: TestClient, collection: Collection) -> None:
168-
response = client.put("/collections/a-collection", content=json.dumps(collection))
163+
response = client.put("/collections/a-collection", json=collection)
169164
assert response.is_success, response.text
170165
assert response.json()["path_collection_id"] == "a-collection"
171166
assert response.json()["type"] == "Collection"
@@ -174,7 +169,7 @@ def test_update_collection(client: TestClient, collection: Collection) -> None:
174169
def test_patch_operation_collection(client: TestClient) -> None:
175170
response = client.patch(
176171
"/collections/a-collection",
177-
content='[{"op": "add", "path": "/properties/foo", "value": "bar"}]',
172+
json=[{"op": "add", "path": "/properties/foo", "value": "bar"}],
178173
)
179174
assert response.is_success, response.text
180175
assert response.json()["path_collection_id"] == "a-collection"
@@ -186,7 +181,7 @@ def test_patch_operation_collection(client: TestClient) -> None:
186181
def test_patch_merge_collection(client: TestClient) -> None:
187182
response = client.patch(
188183
"/collections/a-collection",
189-
content=json.dumps({"summaries": {"hello": "world", "foo": None}}),
184+
json={"summaries": {"hello": "world", "foo": None}},
190185
)
191186
assert response.is_success, response.text
192187
assert response.json()["path_collection_id"] == "a-collection"

0 commit comments

Comments
 (0)