Skip to content

Commit

Permalink
add tests for recent pysquril where clause improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
leondutoit committed Apr 19, 2024
1 parent a75c72b commit 9b84fe7
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tsdfileapi/test_file_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,10 @@ def test_app_backend(self) -> None:
)
except Exception:
pass
try:
resp = requests.delete(f"{self.apps}/ega/tables/lol", headers=headers)
except Exception:
pass

# add some data
resp = requests.put(
Expand Down Expand Up @@ -2154,6 +2158,37 @@ def test_app_backend(self) -> None:
self.assertEqual(resp.status_code, 200)
self.assertTrue(len(json.loads(resp.text)) > 0)

# test query features
data = [
{"id": 1, "cat": "&", "comment": "dis 'n mooi dag"},
{"id": 2, "cat": None},
{"id": 3, "cat": "yes"},
]
resp = requests.put(
f"{self.apps}/ega/tables/lol",
data=json.dumps(data),
headers=headers,
)
self.assertEqual(resp.status_code, 201)

# ampersand in where
resp = requests.get(
f"{self.apps}/ega/tables/lol?select=id&where=cat=eq.'&'",
headers=headers,
)
self.assertEqual(json.loads(resp.text), [[1]])

# escaping a single quote
resp = requests.get(
f"{self.apps}/ega/tables/lol?select=id&where=comment=eq.'dis \\'n mooi dag'",
headers=headers,
)
self.assertEqual(json.loads(resp.text), [[1]])

# cleanup
resp = requests.delete(f"{self.apps}/ega/tables/lol", headers=headers)
self.assertEqual(resp.status_code, 200)

def test_app_backend_encryption(self) -> None:
"""Test app backend with encrypted retrieval of data."""

Expand Down

0 comments on commit 9b84fe7

Please sign in to comment.