diff --git a/src/citrine/__version__.py b/src/citrine/__version__.py index 721f45d33..dbea1a391 100644 --- a/src/citrine/__version__.py +++ b/src/citrine/__version__.py @@ -1 +1 @@ -__version__ = "3.22.1" +__version__ = "3.23.0" diff --git a/src/citrine/resources/project.py b/src/citrine/resources/project.py index bddc887ef..561374c6e 100644 --- a/src/citrine/resources/project.py +++ b/src/citrine/resources/project.py @@ -728,6 +728,24 @@ def search(self, return self._build_collection_elements(self.search_all(search_params)) # To avoid setting default to {} -> reduce mutation risk, and to make more extensible + def archive(self, uid: Union[UUID, str]) -> Response: + """Archive a project.""" + # Only the team-agnostic project archive is implemented + if self.team_id is None: + path = self._get_path(uid, action="archive") + return self.session.post_resource(path, version=self._api_version, json=None) + else: + return ProjectCollection(session=self.session).archive(uid) + + def restore(self, uid: Union[UUID, str]) -> Response: + """Restore an archived project.""" + # Only the team-agnostic project restore is implemented + if self.team_id is None: + path = self._get_path(uid, action="restore") + return self.session.post_resource(path, version=self._api_version, json=None) + else: + return ProjectCollection(session=self.session).restore(uid) + def delete(self, uid: Union[UUID, str]) -> Response: """ Delete a particular project. diff --git a/tests/resources/test_project.py b/tests/resources/test_project.py index 28a869860..11bb97fa2 100644 --- a/tests/resources/test_project.py +++ b/tests/resources/test_project.py @@ -559,6 +559,32 @@ def test_search_projects_no_search_params(collection: ProjectCollection): assert len(projects_data) == len(result) +def test_archive_project(collection, session): + # Given + uid = '151199ec-e9aa-49a1-ac8e-da722aaf74c4' + + # When + collection.archive(uid) + + # Then + assert 1 == session.num_calls + expected_call = FakeCall(method='POST', path=f'/projects/{uid}/archive') + assert expected_call == session.last_call + + +def test_restore_project(collection, session): + # Given + uid = '151199ec-e9aa-49a1-ac8e-da722aaf74c4' + + # When + collection.restore(uid) + + # Then + assert 1 == session.num_calls + expected_call = FakeCall(method='POST', path=f'/projects/{uid}/restore') + assert expected_call == session.last_call + + def test_delete_project(collection, session): # Given uid = '151199ec-e9aa-49a1-ac8e-da722aaf74c4'