diff --git a/src/api/tests/sample_data/07ba4a2f-c0a2-44ba-96d8-7b4cc94c8ee7.mp4 b/src/api/tests/sample_data/07ba4a2f-c0a2-44ba-96d8-7b4cc94c8ee7.mp4 deleted file mode 100644 index 33d3ab1d..00000000 Binary files a/src/api/tests/sample_data/07ba4a2f-c0a2-44ba-96d8-7b4cc94c8ee7.mp4 and /dev/null differ diff --git a/src/api/tests/sample_data/c8709f21-bd7d-4e22-af14-50ad8a429f84.jpeg b/src/api/tests/sample_data/c8709f21-bd7d-4e22-af14-50ad8a429f84.jpeg deleted file mode 100644 index 51f5b9d5..00000000 Binary files a/src/api/tests/sample_data/c8709f21-bd7d-4e22-af14-50ad8a429f84.jpeg and /dev/null differ diff --git a/src/api/tests/sample_data/people.jpg b/src/api/tests/sample_data/people.jpg new file mode 100644 index 00000000..0942fce4 Binary files /dev/null and b/src/api/tests/sample_data/people.jpg differ diff --git a/src/api/tests/sample_data/sample-cat-video.mp4 b/src/api/tests/sample_data/sample-cat-video.mp4 new file mode 100644 index 00000000..14ac4b12 Binary files /dev/null and b/src/api/tests/sample_data/sample-cat-video.mp4 differ diff --git a/src/api/tests/test_index_api_as_client.py b/src/api/tests/test_index_api_as_client.py index 827cf1f4..99ac6112 100644 --- a/src/api/tests/test_index_api_as_client.py +++ b/src/api/tests/test_index_api_as_client.py @@ -80,7 +80,6 @@ def testIndexVideo(self): # "media": open("sample_data/simple-text.txt", "rb"), "data": json.dumps(data), } - # axios.post("endpoint", data) response = requests.post(url, json=data, headers=headers) print(response.text) self.assertEqual(response.status_code, 200) @@ -88,11 +87,13 @@ def testIndexVideo(self): @skip def testIndexEnqueueImage(self): url = API_URL + "/search" + # headers = {"Content-Type": "application/json"} + headers = {"Content-Type": "multipart/form-data"} data = { "post": { "id": "1234", "media_type": "image", - "media_url": "https://fs.tattle.co.in/service/kosh/file/c8709f21-bd7d-4e22-af14-50ad8a429f84", + "media_url": "https://raw.githubusercontent.com/tattle-made/feluda/master/src/api/core/operators/sample_data/people.jpg", "datasource_id": "asdfasdf-asdfasdf-asdf", "client_id": "123-12312", }, @@ -100,8 +101,8 @@ def testIndexEnqueueImage(self): "config": {"mode": "enqueue", "version": "0.1"}, } files = {"data": json.dumps(data)} - response = requests.post(url, files=files) - print(response.json()) + response = requests.post(url, json=data, headers=headers) + print(response.text) self.assertEqual(response.status_code, 200) @skip diff --git a/src/api/tests/test_search_api_as_client.py b/src/api/tests/test_search_api_as_client.py index 07931434..b05f46a8 100644 --- a/src/api/tests/test_search_api_as_client.py +++ b/src/api/tests/test_search_api_as_client.py @@ -28,7 +28,7 @@ def testSearchRawQuery(self): def testSearchImage(self): url = API_URL + "/search" data = {"query_type": "image"} - with open("sample_data/c8709f21-bd7d-4e22-af14-50ad8a429f84.jpeg", "rb") as file: + with open("sample_data/people.jpg", "rb") as file: data = {"data": json.dumps(data)} files = {"media": file} response = requests.post(url, data=data, files=files) @@ -39,7 +39,7 @@ def testSearchImage(self): # @skip def testIndexVideo(self): url = API_URL + "/search" - with open("sample_data/07ba4a2f-c0a2-44ba-96d8-7b4cc94c8ee7.mp4", "rb") as file: + with open("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)