Skip to content

Commit

Permalink
test: Update fixtures, because libcove no longer errors on non-dict v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
jpmckinney committed Jul 9, 2024
1 parent 461a91d commit 8266c77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
File renamed without changes.
12 changes: 6 additions & 6 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,14 @@ def test_500_error(server_url, browser):
),
("tenders_releases_2_releases_codelists.json", ["oh no", "GSINS"], [], True),
# Test UTF-8 support
("utf8.json", "Convert", ["Ensure that your file uses UTF-8 encoding"], True),
("utf8.json", ["Convert"], ["Ensure that your file uses UTF-8 encoding"], True),
# Test that non UTF-8 files get an error, with a helpful message
("latin1.json", "Ensure that your file uses UTF-8 encoding", [], False),
("utf-16.json", "Ensure that your file uses UTF-8 encoding", [], False),
("latin1.json", ["Ensure that your file uses UTF-8 encoding"], [], False),
("utf-16.json", ["Ensure that your file uses UTF-8 encoding"], [], False),
# But we expect to see an error message if a file is not well formed JSON at all
(
"tenders_releases_2_releases_not_json.json",
"not well formed JSON",
["not well formed JSON"],
[],
False,
),
Expand All @@ -406,8 +406,8 @@ def test_500_error(server_url, browser):
["Missing OCDS package"],
True,
),
# Test unconvertable JSON (main sheet "releases" is missing)
("unconvertable_json.json", "could not be converted", [], False),
# Test non-dict JSON (main sheet "releases" is missing)
("non_dict_json.json", [], ["could not be converted"], False),
(
"full_record.json",
[
Expand Down
8 changes: 4 additions & 4 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ def test_explore_unconvertable_spreadsheet(client):


@pytest.mark.django_db
def test_explore_unconvertable_json(client):
def test_explore_non_dict_json(client):
data = SuppliedData.objects.create()
with open(os.path.join("tests", "fixtures", "unconvertable_json.json")) as fp:
data.original_file.save("unconvertable_json.json", UploadedFile(fp))
with open(os.path.join("tests", "fixtures", "non_dict_json.json")) as fp:
data.original_file.save("non_dict_json.json", UploadedFile(fp))
resp = client.post(data.get_absolute_url(), {"flatten": "true"})
assert resp.status_code == 200
assert b"could not be converted" in resp.content
assert b"could not be converted" not in resp.content


@pytest.mark.django_db
Expand Down

0 comments on commit 8266c77

Please sign in to comment.