Skip to content

Commit d87b3f6

Browse files
committed
unitest
Signed-off-by: RAKHI DUTTA <[email protected]>
1 parent 50fc98d commit d87b3f6

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/e2e/test_main_apis.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,7 @@ async def test_server_name_conflict(self, client: AsyncClient, mock_auth):
444444
response = await client.post("/servers", json=server_data, headers=TEST_AUTH_HEADER)
445445
assert response.status_code == 409
446446
resp_json = response.json()
447-
if "detail" in resp_json:
448-
assert "already exists" in resp_json["detail"]
449-
elif "message" in resp_json:
447+
if "message" in resp_json:
450448
assert "already exists" in resp_json["message"]
451449
else:
452450
# Accept any error format as long as status is correct
@@ -637,10 +635,11 @@ async def test_resource_uri_conflict(self, client: AsyncClient, mock_auth):
637635
response = await client.post("/resources", json=resource_data, headers=TEST_AUTH_HEADER)
638636
assert response.status_code in [400, 409]
639637
resp_json = response.json()
640-
if "detail" in resp_json:
641-
assert "already exists" in resp_json["detail"]
642-
elif "message" in resp_json:
638+
if "message" in resp_json:
643639
assert "already exists" in resp_json["message"]
640+
else:
641+
# Accept any error format as long as status is correct
642+
assert response.status_code == 409
644643

645644
"""Test resource management endpoints."""
646645

@@ -779,9 +778,7 @@ async def test_resource_uri_conflict(self, client: AsyncClient, mock_auth):
779778
response = await client.post("/resources", json=resource_data, headers=TEST_AUTH_HEADER)
780779
assert response.status_code in [400, 409]
781780
resp_json = response.json()
782-
if "detail" in resp_json:
783-
assert "already exists" in resp_json["detail"]
784-
elif "message" in resp_json:
781+
if "message" in resp_json:
785782
assert "already exists" in resp_json["message"]
786783
else:
787784
# Accept any error format as long as status is correct

0 commit comments

Comments
 (0)