Skip to content

Commit

Permalink
Index filtering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CWestICL committed Sep 22, 2023
1 parent 0cffc14 commit fc0bdcf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_dsr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,25 @@ def test_get_dsr_api(dsr_data):
new_data = dsr_data.copy()
new_data["Name"] = "A new entry"
dt.dsr_data.append(new_data)
new_data = dsr_data.copy()
new_data["Name"] = "Another new entry"
dt.dsr_data.append(new_data)

response = client.get("/dsr")
assert response.json()["data"][0]["Name"] == dt.dsr_data[2]["Name"]

# Checks index filtering
response = client.get("/dsr?start=1")
assert len(response.json()["data"]) == 2
assert response.json()["data"][0]["Name"] == dt.dsr_data[1]["Name"]
assert response.json()["data"][1]["Name"] == dt.dsr_data[2]["Name"]

response = client.get("/dsr?start=0&end=1")
assert len(response.json()["data"]) == 2
assert response.json()["data"][0]["Name"] == dt.dsr_data[0]["Name"]
assert response.json()["data"][1]["Name"] == dt.dsr_data[1]["Name"]

# Checks column filtering
response = client.get("/dsr?col=activities")
assert len(response.json()["data"][0].keys()) == 1
assert "Activities" in response.json()["data"][0].keys()
Expand Down

0 comments on commit fc0bdcf

Please sign in to comment.