Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Feb 2, 2025
1 parent 81d2177 commit 027d81c
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions packages/opal-client/opal_client/tests/data_updater_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,18 @@ async def test_data_updater(server):
proc.terminate()

# test PATCH update event via API
entries = [
DataSourceEntry(
url="",
data=PATCH_DATA_UPDATE,
dst_path="/",
topics=DATA_TOPICS,
save_method="PATCH",
)
]
update = DataUpdate(
reason="Test_Patch", entries=entries, callback=UpdateCallback(callbacks=[])
reason="Test_Patch",
entries=[
DataSourceEntry(
url="",
data=PATCH_DATA_UPDATE,
dst_path="/",
topics=DATA_TOPICS,
save_method="PATCH",
)
],
callback=UpdateCallback(callbacks=[]),
)

headers = {"content-type": "application/json"}
Expand All @@ -218,10 +219,23 @@ async def test_data_updater(server):
)
assert res.status_code == 200
# value field is not specified for add operation should fail
entries[0].data = [{"op": "add", "path": "/"}]
res = requests.post(
DATA_UPDATE_ROUTE,
data=json.dumps(update, default=pydantic_encoder),
data=json.dumps(
{
"reason": "Test_Patch",
"entries": [
{
"url": "",
"data": [{"op": "add", "path": "/"}],
"dst_path": "/",
"topics": DATA_TOPICS,
"save_method": "PATCH",
}
],
},
default=pydantic_encoder,
),
headers=headers,
)
assert res.status_code == 422, res.text
Expand Down

0 comments on commit 027d81c

Please sign in to comment.