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:
Akita Noek
2016-02-22 16:50:13 -05:00
parent 73b2105a30
commit 9be9cf9b72
4 changed files with 12 additions and 2 deletions

View File

@@ -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