Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Adding missing method expected from qgis-plug-ci: delete() #19

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pytransifex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def create_project(
else:
logging.error(f"Unable to create project; API replied with {error}")

@ensure_login
def delete_project(self, project_slug: str):
if project := self.get_project(project_slug=project_slug):
project.delete()
logging.info(f"Deleted project: {project_slug}")

@ensure_login
def get_project(self, project_slug: str) -> None | Resource:
"""Fetches the project matching the given slug"""
Expand Down
5 changes: 2 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def setUpClass(cls):
f"Unable to complete test with broken tests inputs. Found missing: {missing}"
)

if project := cls.tx.get_project(project_slug=cls.project_slug):
logging.info("Found old project, removing.")
project.delete()
logging.info("Deleting test project if it already exists")
cls.tx.delete_project(project_slug=cls.project_slug)

logging.info("Creating a brand new project")
cls.tx.create_project(
Expand Down