Add test for removing env role in update_environment_roles

This commit is contained in:
richard-dds
2018-10-17 16:03:38 -04:00
parent c138df2b0f
commit 0f6fee9909
5 changed files with 74 additions and 5 deletions

View File

@@ -56,6 +56,18 @@ class WorkspaceUser(object):
.count()
)
@property
def environment_roles(self):
return (
db.session.query(EnvironmentRole)
.join(EnvironmentRole.environment)
.join(Environment.project)
.join(Project.workspace)
.filter(Project.workspace_id == self.workspace_id)
.filter(EnvironmentRole.user_id == self.user_id)
.all()
)
@property
def has_environment_roles(self):
return self.num_environment_roles > 0