Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IO-1801][external] Core item archive method & tests #702

Merged
merged 2 commits into from
Oct 27, 2023
Merged

Conversation

JBWilkie
Copy link
Collaborator

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

@@ -245,3 +245,5 @@ def raise_for_darwin_exception(response: requests.Response) -> None:
raise Unauthorized(response)
if response.status_code == 404:
raise NotFound(response)
if response.status_code == 422:
Copy link
Collaborator 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
13 checks passed
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.

2 participants