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

Patch #176 #177

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 5 additions & 9 deletions pharus/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,11 @@ def _fetch_records(
# Loop through each attributes, append to the tuple_to_return with specific
# modification based on data type
for attribute_name, attribute_info in attributes.items():
if attribute_info.is_external:
# Attribute is external type (filepath or attach),
# thus fill it in string instead
(
row.append(non_blobs_row[attribute_name])
if fetch_blobs
else row.append("=FILE=")
)
elif not attribute_info.is_blob:
if not (
attribute_info.is_blob
or attribute_info.is_attachment
or attribute_info.is_filepath
):
if non_blobs_row[attribute_name] is None:
# If it is none then just append None
row.append(None)
Expand Down
10 changes: 8 additions & 2 deletions tests/test_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ def validate(table, inserted_value, expected_type, expected_value, client, token
),
)
assert REST_response.status_code == 200
REST_records = client.get(
resp = client.get(
f"/schema/{table.database}/table/{table.__name__}/record",
headers=dict(Authorization=f"Bearer {token}"),
).json["records"]
)
assert resp.status_code == 200, f"Failed to get records: {resp.text=}"
assert (
resp.json is not None
), f"resp.json is None: {resp=} {dir(resp)=} {resp.text=}"
assert "records" in resp.json, f"No records in response: {resp.json=}"
REST_records = resp.json["records"]
assert len(REST_records) == 1
assert (
isinstance(REST_records[0][1], expected_type)
Expand Down
Loading