Skip to content

Conversation

@JBWilkie
Copy link
Contributor

Problem

Currently no way to archive items in darwin.future

Solution

Define the core method to archive a list of items by their UUIDs by using the archive endpoint

Changelog

Added core item archive method & tests

@linear
Copy link

linear bot commented Oct 26, 2023

raise Unauthorized(response)
if response.status_code == 404:
raise NotFound(response)
if response.status_code == 422:
Copy link
Contributor Author

@JBWilkie JBWilkie Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to surface / deal with / pprint 422s later, especially because the endpoints generally do a good job of pointing out exactly what causes 422s

Copy link
Contributor

@owencjones owencjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one change, and it's really minor lint change at the bottom - this is good stuff mate.

responses.add(
responses.POST,
base_client.config.api_endpoint + "v2/teams/test-team/items/archive",
json={"affected_item_count": 0},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really minor point, but your affect item count here is mocked as 0, when if successful, it would've been 2.

Honestly, only fix if you want to.

assert response == {"affected_item_count": 0}


def test_archive_items_with_error_response(base_client: ClientCore) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base_client fixture is included but not used here.

@JBWilkie JBWilkie merged commit 009bb2c into master Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants