@@ -124,6 +124,24 @@ def test_old_entity_gone_shown(test_data_old_entities, client, exclude_middlewar
124
124
assert (
125
125
f"This entity (#{ old_entity .old_entity_id } ) has been removed." in response .text
126
126
)
127
+ assert (
128
+ "text/html" in response .headers ["Content-Type" ]
129
+ ), "Expected response in text/html format"
130
+
131
+
132
+ def test_old_entity_gone_json_shown (test_data_old_entities , client , exclude_middleware ):
133
+ """
134
+ Test entity endpoint returns entity gone content
135
+ """
136
+ old_entity = test_data_old_entities ["old_entities" ][410 ][0 ]
137
+ response = client .get (
138
+ f"/entity/{ old_entity .old_entity_id } .json" , allow_redirects = False
139
+ )
140
+ assert response .status_code == 410
141
+ assert (
142
+ response .headers ["Content-Type" ] == "application/json"
143
+ ), "Expected response in JSON format"
144
+ assert f"Entity { old_entity .old_entity_id } has been removed" in response .text
127
145
128
146
129
147
def test_dataset_json_endpoint_returns_as_expected (test_data , client ):
@@ -308,6 +326,9 @@ def test_get_by_curie_redirects_to_entity(test_data, client, exclude_middleware)
308
326
def test_get_by_curie_404s_for_unknown_reference (test_data , client , exclude_middleware ):
309
327
response = client .get ("/curie/not:found" , allow_redirects = False )
310
328
assert response .status_code == 404
329
+ expected_content = "Page not found"
330
+ # Check if the expected content is present in the response body
331
+ assert expected_content in response .text
311
332
312
333
313
334
def test_get_dataset_unknown_returns_404 (client , exclude_middleware ):
0 commit comments