Skip to content

Commit

Permalink
Changes to tests to make them consistent with others
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie committed Nov 9, 2023
1 parent 4c784b2 commit 8af715c
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions darwin/future/tests/core/items/test_move_items_to_folder.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from unittest.mock import Mock
from uuid import UUID

import pytest
import responses
from pytest import raises

from darwin.exceptions import DarwinException
from darwin.future.core.client import ClientCore
from darwin.future.core.items.move_items_to_folder import move_list_of_items_to_folder
from darwin.future.exceptions import BadRequest
from darwin.future.tests.core.fixtures import *


Expand Down Expand Up @@ -41,18 +40,24 @@ def test_move_list_of_items_to_folder_including_filters(
assert response == {"affected_item_count": 2}


def test_move_list_of_items_to_folder_with_error_response() -> None:
api_client = Mock(spec=ClientCore)
api_client.post.side_effect = DarwinException("Something went wrong")

with pytest.raises(DarwinException):
move_list_of_items_to_folder(
api_client=api_client,
team_slug="test-team",
dataset_id=000000,
item_ids=[
UUID("00000000-0000-0000-0000-000000000000"),
UUID("00000000-0000-0000-0000-000000000000"),
],
path="/test/path",
)
def test_move_list_of_items_to_folder_with_error_response(
base_client: ClientCore,
) -> None:
with raises(BadRequest):
with responses.RequestsMock() as rsps:
rsps.add(
responses.POST,
base_client.config.api_endpoint + "v2/teams/test-team/items/path",
status=400,
)

move_list_of_items_to_folder(
api_client=base_client,
team_slug="test-team",
dataset_id=000000,
item_ids=[
UUID("00000000-0000-0000-0000-000000000000"),
UUID("00000000-0000-0000-0000-000000000000"),
],
path="/test/path",
)

0 comments on commit 8af715c

Please sign in to comment.