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

Commit

Permalink
delete team
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jul 16, 2020
1 parent 2ece9a9 commit 4d8fc77
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pytransifex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ def list_resources(self, project_slug) -> list:

return json.loads(codecs.decode(response.content, 'utf-8'))

def delete_team(self, team_slug: str):
url = 'https://rest.api.transifex.com/projects/o:{o}:t:{t}'.format(o=self.organization, t=team_slug)
response = requests.delete(url, headers={'Content-Type': 'application/vnd.api+json','Authorization': 'Bearer {}'.format(self.api_key)})
if response.status_code != requests.codes['OK']:
raise PyTransifexException(response)

def create_resource(self,
project_slug,
path_to_file,
Expand Down
6 changes: 5 additions & 1 deletion test/test_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
token = os.getenv('TX_TOKEN')
assert token is not None
self.t = Transifex(organization='pytransifex', api_token=token)
self.project_slug = 'pytransifex'
self.project_slug = 'pytransifex-test-project'
self.project_name = 'PyTransifex Test project'
self.source_lang = 'fr_FR'

Expand All @@ -21,6 +21,10 @@ def tearDown(self):
self.t.delete_project(self.project_slug)
except PyTransifexException:
pass
try:
self.t.delete_team('{}-team'.format(self.project_slug))
except PyTransifexException:
pass

def test_creation(self):
self.tearDown()
Expand Down

0 comments on commit 4d8fc77

Please sign in to comment.