Skip to content

Commit

Permalink
test purging of users
Browse files Browse the repository at this point in the history
- after deletion
- direct (i.e. without deletion)
  • Loading branch information
bernt-matthias committed May 2, 2024
1 parent 9e6ab29 commit 817bde3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bioblend/_tests/TestGalaxyUsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ def test_create_local_user(self):
# test a BioBlend GalaxyInstance can be created using username+password
user_gi = bioblend.galaxy.GalaxyInstance(url=self.gi.base_url, email=new_user_email, password=password)
assert user_gi.users.get_current_user()["email"] == new_user_email
# test deletion
# test deletion and purging
assert self.gi.config.get_config()["allow_user_deletion"]
if self.gi.config.get_config()["allow_user_deletion"]:
deleted_user = self.gi.users.delete_user(new_user["id"])
assert deleted_user["email"] == new_user_email
assert deleted_user["deleted"]

purged_user = self.gi.users.delete_user(new_user["id"], purge=True)
assert purged_user["email"] == new_user_email
assert purged_user["deleted"]
assert purged_user["purged"]

def test_get_current_user(self):
user = self.gi.users.get_current_user()
assert user["id"] is not None
Expand All @@ -86,9 +91,11 @@ def test_update_user(self):
assert updated_user["username"] == updated_username
assert updated_user["email"] == updated_user_email

assert self.gi.config.get_config()["allow_user_deletion"]
# delete user after test (if possile), also tests purging without prior deletion
if self.gi.config.get_config()["allow_user_deletion"]:
self.gi.users.delete_user(new_user_id)
purged_user = self.gi.users.delete_user(new_user_id, purge=True)
assert purged_user["deleted"]
assert purged_user["purged"]

def test_get_user_apikey(self):
# Test getting the API key of the current user, which surely has one
Expand Down

0 comments on commit 817bde3

Please sign in to comment.