diff --git a/source/web-service/tests/test_routes_ingest.py b/source/web-service/tests/test_routes_ingest.py index 44bafc8b..54506302 100644 --- a/source/web-service/tests/test_routes_ingest.py +++ b/source/web-service/tests/test_routes_ingest.py @@ -154,6 +154,37 @@ def test_ingest_single(self, client_no_rdf, namespace, auth_token, test_db_no_rd assert response.status_code == 200 assert b"object/12345" in response.data + def test_ingest_unicode(self, client_no_rdf, namespace, auth_token, test_db_no_rdf): + data = { + "id": "unicodetest/1", + "tags": [ + { + "id": "123", + "name": "Airport", + "name_en": "Airport", + "name_cn": "机场", + "display": False, + } + ], + } + + # Python 3.5+ (maybe earlier) handles UTF-8 by default + response = client_no_rdf.post( + f"/{namespace}/ingest", + data=json.dumps(data), + headers={"Authorization": "Bearer " + auth_token}, + ) + assert response.status_code == 200 + assert b"unicodetest/1" in response.data + + response = client_no_rdf.get(f"/{namespace}/unicodetest/1") + assert response.status_code == 200 + + rdoc = response.json + + # check unicode + assert rdoc["tags"][0]["name_cn"] == "机场" + def test_ingest_multiple( self, client_no_rdf, namespace, auth_token, test_db_no_rdf ):