Skip to content

Commit

Permalink
Test with user-specified MIME types in test_get_document
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Feb 3, 2025
1 parent 0959572 commit 2f9f2b7
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/deploy/api/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def sorting_key(d):
)


def test_get_document(tmp_local_root):
@mime_types
def test_get_document(tmp_local_root, mime_type):
config = Config(local_root=tmp_local_root)

document_root = config.local_root / "documents"
Expand All @@ -74,11 +75,25 @@ def test_get_document(tmp_local_root):
file.write(_document_content_text[0])

with make_api_client(config=config, ignore_unavailable_components=False) as client:
document = upload_documents(client=client, document_paths=[document_path])[0]
document = upload_documents(
client=client,
document_paths=[document_path],
mime_types=[mime_type],
)[0]
response = client.get(f"/api/documents/{document['id']}").raise_for_status()

assert document == response.json()

assert (
document["mime_type"]
== response.json()["mime_type"]
== (
mime_type
if mime_type is not None
else mimetypes.guess_type(document_path.name)[0]
)
)


def test_get_document_content(tmp_local_root):
config = Config(local_root=tmp_local_root)
Expand Down

0 comments on commit 2f9f2b7

Please sign in to comment.