Don't explicitly add project creator to environments

This commit is contained in:
richard-dds 2018-09-25 15:54:57 -04:00
parent b65fdd56a0
commit c9c387b06d
2 changed files with 5 additions and 8 deletions

View File

@ -5,7 +5,6 @@ from atst.domain.exceptions import NotFoundError
from atst.models.permissions import Permissions
from atst.models.project import Project
from atst.models.environment import Environment
from atst.models.environment_role import EnvironmentRole
class Projects(object):
@ -14,9 +13,7 @@ class Projects(object):
project = Project(workspace=workspace, name=name, description=description)
db.session.add(project)
environments = Environments.create_many(project, environment_names)
for environment in environments:
Environments.add_member(environment, user, "owner")
Environments.create_many(project, environment_names)
db.session.commit()
return project

View File

@ -16,14 +16,14 @@ def test_create_project_with_multiple_environments():
assert sorted(e.name for e in project.environments) == ["dev", "prod"]
def test_project_creator_has_environment_access():
def test_workspace_owner_can_view_environments():
owner = UserFactory.create()
request = RequestFactory.create(creator=owner)
workspace = Workspaces.create(request)
project = Projects.create(
_project = Projects.create(
owner, workspace, "My Test Project", "Test", ["dev", "prod"]
)
environment = project.environments[0]
project = Projects.get(owner, workspace, _project.id)
assert owner in environment.users
assert len(project.environments) == 2