mirror of
https://github.com/ansible/awx.git
synced 2026-06-30 19:08:02 -02:30
Fixed RBAC migration tests considering new signal handlers that are a bit too helpful during testing
We have some signal handlers now that perform work that do work automatically that we want to explicitly test in our migration path, so we have to undo some things in order to test the migration code.
This commit is contained in:
@@ -10,11 +10,16 @@ def test_user_admin(user_project, project, user):
|
||||
admin = user('admin', is_superuser = True)
|
||||
sa = Role.singleton('System Administrator')
|
||||
|
||||
# this should happen automatically with our signal
|
||||
assert sa.members.filter(id=admin.id).exists() is True
|
||||
sa.members.remove(admin)
|
||||
|
||||
assert sa.members.filter(id=joe.id).exists() is False
|
||||
assert sa.members.filter(id=admin.id).exists() is False
|
||||
|
||||
migrations = rbac.migrate_users(apps, None)
|
||||
|
||||
# The migration should add the admin back in
|
||||
assert sa.members.filter(id=joe.id).exists() is False
|
||||
assert sa.members.filter(id=admin.id).exists() is True
|
||||
assert len(migrations) == 1
|
||||
|
||||
Reference in New Issue
Block a user