Skip to content

Commit

Permalink
fix: index and search tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya authored and dennyabrain committed Feb 21, 2024
1 parent 91c797b commit ffc8efc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/tests/test_index_api_as_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def testIndexImage(self):
"metadata": {"domain": "hate_speech", "type": ["gender", "caste"]},
"config": {"mode": "store", "version": "0.1"},
}
with open("sample_data/simple-text.txt", "rb") as media_file:
files = {
"media": media_file,
"data": json.dumps(data),
}
response = requests.post(url, json=data, headers=headers)
# response = requests.post(url, json=data, files=files, headers=headers)
print(response.text)
self.assertEqual(response.status_code, 200)
# with open("sample_data/simple-text.txt", "rb") as media_file:
# files = {
# "media": media_file,
# "data": json.dumps(data),
# }
response = requests.post(url, json=data, headers=headers)
# response = requests.post(url, json=data, files=files, headers=headers)
print(response.text)
self.assertEqual(response.status_code, 200)

# @skip
def testIndexVideo(self):
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_search_api_as_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def testSearchRawQuery(self):
def testSearchImage(self):
url = API_URL + "/search"
data = {"query_type": "image"}
with open("sample_data/people.jpg", "rb") as file:
with open("tests/sample_data/people.jpg", "rb") as file:
data = {"data": json.dumps(data)}
files = {"media": file}
response = requests.post(url, data=data, files=files)
Expand All @@ -39,7 +39,7 @@ def testSearchImage(self):
# @skip
def testIndexVideo(self):
url = API_URL + "/search"
with open("sample_data/sample-cat-video.mp4", "rb") as file:
with open("tests/sample_data/sample-cat-video.mp4", "rb") as file:
data = {"data": json.dumps({"query_type": "video"})}
files = {"media": file}
response = requests.post(url, data=data, files=files)
Expand Down

0 comments on commit ffc8efc

Please sign in to comment.