Skip to content

Commit

Permalink
feat: add update_vector_settings unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmbmb committed Nov 3, 2023
1 parent d25fb70 commit c886798
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 54 deletions.
54 changes: 0 additions & 54 deletions tests/integration/client/sdk/v1/test_vectors_settings.py

This file was deleted.

13 changes: 13 additions & 0 deletions tests/unit/client/sdk/v1/vectors_settings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
42 changes: 42 additions & 0 deletions tests/unit/client/sdk/v1/vectors_settings/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from uuid import uuid4

import httpx
from argilla.client.sdk.v1.vectors_settings.api import update_vector_settings


class TestSuiteVectorsSettingsSDK:
def test_update_vector_settings(self, mock_httpx_client: httpx.Client) -> None:
vector_settings_id = uuid4()
mock_httpx_client.patch.return_value = httpx.Response(
status_code=200,
json={
"id": str(vector_settings_id),
"name": "vector-settings",
"title": "new-title",
"dimensions": 128,
"dataset_id": str(uuid4()),
"inserted_at": "2021-09-13T12:00:00Z",
"updated_at": "2021-09-13T12:00:00Z",
},
)
response = update_vector_settings(client=mock_httpx_client, id=vector_settings_id, title="new-title")
assert response.status_code == 200
assert response.parsed.title == "new-title"
assert mock_httpx_client.patch.called_once_with(
url=f"/api/v1/vectors-settings/{vector_settings_id}",
json={"title": "new-title"},
)

0 comments on commit c886798

Please sign in to comment.