Filter deleted environment roles from top-level domain method.
This commit is contained in:
parent
32df561c6d
commit
8add5b4e22
@ -45,5 +45,6 @@ class EnvironmentRoles(object):
|
||||
.filter(EnvironmentRole.user_id == user_id)
|
||||
.filter(Application.id == application_id)
|
||||
.filter(EnvironmentRole.environment_id == Environment.id)
|
||||
.filter(EnvironmentRole.deleted != True)
|
||||
.all()
|
||||
)
|
||||
|
@ -14,3 +14,13 @@ def test_get_for_application_and_user():
|
||||
assert len(roles) == 1
|
||||
assert roles[0].environment == env1
|
||||
assert roles[0].user == user
|
||||
|
||||
|
||||
def test_get_for_application_and_user_does_not_return_deleted():
|
||||
user = UserFactory.create()
|
||||
application = ApplicationFactory.create()
|
||||
env1 = EnvironmentFactory.create(application=application)
|
||||
EnvironmentRoleFactory.create(user=user, environment=env1, deleted=True)
|
||||
|
||||
roles = EnvironmentRoles.get_for_application_and_user(user.id, application.id)
|
||||
assert len(roles) == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user