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

Commit

Permalink
Merge pull request #19 from opengisch/adding-missing-delete
Browse files Browse the repository at this point in the history
Adding missing method expected from qgis-plug-ci: delete()

Tag 0.1.12
  • Loading branch information
why-not-try-calmer committed Feb 21, 2023
2 parents 2de2fe2 + c56b07e commit 8d0aac6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit 8d0aac6

Please sign in to comment.