Skip to content

Commit

Permalink
PR Changes suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen committed Oct 27, 2023
1 parent 2277b2a commit 7328bfb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 8 additions & 4 deletions darwin/future/core/items/set_item_priority.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, List
from uuid import UUID

from darwin.future.core.client import ClientCore
Expand All @@ -10,19 +10,23 @@ def set_item_priority(
api_client: ClientCore,
team_slug: str,
dataset_id: int,
item_id: UUID,
item_ids: List[UUID],
priority: int,
filters: Dict[str, UnknownType] = {},
) -> JSONType:
"""
Sets the priority of an item
Sets the priority of a list of items
Parameters
----------
client: Client
The client to use for the request
team_slug: str
The slug of the team to set the priority for
dataset_id: int
The dataset to set the priority for
item_ids: List[UUID]
The item ids to set the priority for
priority: int
The priority to set
Expand All @@ -33,7 +37,7 @@ def set_item_priority(
payload = {
"priority": priority,
"filters": {
"item_ids": [str(item_id)],
"item_ids": [str(item_id) for item_id in item_ids],
"dataset_ids": [dataset_id],
**filters,
},
Expand Down
10 changes: 5 additions & 5 deletions darwin/future/tests/core/items/test_set_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ def test_set_item_priority(base_client) -> None:
responses.add(
responses.POST,
base_client.config.api_endpoint + "v2/teams/test-team/items/priority",
json={"affected_item_count": 0},
json={"affected_item_count": 1},
)

response = set_item_priority(
base_client,
"test-team",
123,
UUID("00000000-0000-0000-0000-000000000000"),
[UUID("00000000-0000-0000-0000-000000000000")],
999,
)

assert response == {"affected_item_count": 0}
assert response == {"affected_item_count": 1}


def test_set_item_priority_with_filters() -> None:
Expand Down Expand Up @@ -55,7 +55,7 @@ def test_set_item_priority_with_filters() -> None:
base_client,
"test-team",
123,
UUID("00000000-0000-0000-0000-000000000000"),
[UUID("00000000-0000-0000-0000-000000000000")],
priority=10,
filters={"status": "open"},
)
Expand Down Expand Up @@ -83,6 +83,6 @@ def test_set_item_priority_with_error_response() -> None:
api_client=api_client,
team_slug="test-team",
dataset_id=123,
item_id=UUID("00000000-0000-0000-0000-000000000000"),
item_ids=[UUID("00000000-0000-0000-0000-000000000000")],
priority=10,
)

0 comments on commit 7328bfb

Please sign in to comment.