Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode ingest test #361

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions source/web-service/tests/test_routes_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down