From 87debd3ae11dc83575ce8690378ae0779d43b5ef Mon Sep 17 00:00:00 2001 From: Kristof Herrmann Date: Mon, 6 Nov 2023 23:08:11 +0100 Subject: [PATCH] fix --- tests/conftest.py | 6 +++++- tests/integration/api/test_integration_files.py | 2 +- tests/integration/api/test_integration_upload_sessions.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1cf004b6..f6d4f961 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import datetime +import json import os from http import HTTPStatus from typing import List @@ -120,7 +121,10 @@ def workspace_name(integration_config: CommonConfig) -> str: with open("tests/data/example.txt", "rb") as example_file_txt: response = httpx.post( f"{integration_config.api_url}/workspaces/{workspace_name}/files", - files={"file": ("example.txt", example_file_txt, "text/plain")}, + files={ + "file": ("example.txt", example_file_txt, "text/plain"), + "meta": (None, json.dumps({"find": "me"}).encode("utf-8")), + }, headers={"Authorization": f"Bearer {integration_config.api_key}"}, ) assert response.status_code == HTTPStatus.CREATED diff --git a/tests/integration/api/test_integration_files.py b/tests/integration/api/test_integration_files.py index e9961e2a..3803f277 100644 --- a/tests/integration/api/test_integration_files.py +++ b/tests/integration/api/test_integration_files.py @@ -11,7 +11,7 @@ async def test_list_paginated(self, integration_config: CommonConfig, workspace_ async with DeepsetCloudAPI.factory(integration_config) as deepset_cloud_api: files_api = FilesAPI(deepset_cloud_api) result = await files_api.list_paginated( - workspace_name=workspace_name, limit=10, name="Seven", content="HBO's", odata_filter="find eq 'me'" + workspace_name=workspace_name, limit=10, name="example", content="text", odata_filter="find eq 'me'" ) assert result.total == 1 diff --git a/tests/integration/api/test_integration_upload_sessions.py b/tests/integration/api/test_integration_upload_sessions.py index 9fabf46e..0af0d632 100644 --- a/tests/integration/api/test_integration_upload_sessions.py +++ b/tests/integration/api/test_integration_upload_sessions.py @@ -39,11 +39,13 @@ async def test_list_upload_session(self, integration_config: CommonConfig, works async with DeepsetCloudAPI.factory(integration_config) as deepset_cloud_api: upload_session_client = UploadSessionsAPI(deepset_cloud_api) + await upload_session_client.create(workspace_name=workspace_name) + result: UploadSessionDetailList = await upload_session_client.list( - workspace_name=workspace_name, limit=3, page_number=3 + workspace_name=workspace_name, limit=1, page_number=0 ) assert result.total > 0 assert result.has_more is True assert result.data is not None - assert len(result.data) == 3 + assert len(result.data) == 1