Filter out deleted users and organizations from the superuser list
Superusers were getting confused because the users/orgs were being disabled and renamed, but still appeared in the list until they were GCed by the background worker. Now we just hide them. Fixes https://jira.coreos.com/browse/QUAY-936
This commit is contained in:
parent
7878435805
commit
b98c65b3a3
4 changed files with 55 additions and 7 deletions
|
@ -33,16 +33,30 @@ def test_validation_code(token_lifetime, time_since, initialized_db):
|
|||
expect_success = convert_to_timedelta(token_lifetime) >= convert_to_timedelta(time_since)
|
||||
assert expect_success == (result is not None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('disabled', [
|
||||
(True),
|
||||
(False),
|
||||
])
|
||||
def test_get_active_users(disabled, initialized_db):
|
||||
users = get_active_users(disabled=disabled)
|
||||
@pytest.mark.parametrize('deleted', [
|
||||
(True),
|
||||
(False),
|
||||
])
|
||||
def test_get_active_users(disabled, deleted, initialized_db):
|
||||
# Delete a user.
|
||||
deleted_user = model.user.get_user('public')
|
||||
queue = WorkQueue('testgcnamespace', lambda db: db.transaction())
|
||||
mark_namespace_for_deletion(deleted_user, [], queue)
|
||||
|
||||
users = get_active_users(disabled=disabled, deleted=deleted)
|
||||
deleted_found = [user for user in users if user.id == deleted_user.id]
|
||||
assert bool(deleted_found) == (deleted and disabled)
|
||||
|
||||
for user in users:
|
||||
if not disabled:
|
||||
assert user.enabled
|
||||
|
||||
|
||||
def test_mark_namespace_for_deletion(initialized_db):
|
||||
def create_transaction(db):
|
||||
return db.transaction()
|
||||
|
|
Reference in a new issue