workspace -> portfolio everywhere

This commit is contained in:
dandds
2019-01-11 09:58:00 -05:00
parent 3fc323d785
commit d3d36822df
122 changed files with 2156 additions and 2129 deletions

View File

@@ -1,35 +1,35 @@
from atst.domain.applications import Applications
from tests.factories import RequestFactory, UserFactory, WorkspaceFactory
from atst.domain.workspaces import Workspaces
from tests.factories import RequestFactory, UserFactory, PortfolioFactory
from atst.domain.portfolios import Portfolios
def test_create_application_with_multiple_environments():
request = RequestFactory.create()
workspace = Workspaces.create_from_request(request)
portfolio = Portfolios.create_from_request(request)
application = Applications.create(
workspace.owner, workspace, "My Test Application", "Test", ["dev", "prod"]
portfolio.owner, portfolio, "My Test Application", "Test", ["dev", "prod"]
)
assert application.workspace == workspace
assert application.portfolio == portfolio
assert application.name == "My Test Application"
assert application.description == "Test"
assert sorted(e.name for e in application.environments) == ["dev", "prod"]
def test_workspace_owner_can_view_environments():
def test_portfolio_owner_can_view_environments():
owner = UserFactory.create()
workspace = WorkspaceFactory.create(
portfolio = PortfolioFactory.create(
owner=owner,
applications=[{"environments": [{"name": "dev"}, {"name": "prod"}]}],
)
application = Applications.get(owner, workspace, workspace.applications[0].id)
application = Applications.get(owner, portfolio, portfolio.applications[0].id)
assert len(application.environments) == 2
def test_can_only_update_name_and_description():
owner = UserFactory.create()
workspace = WorkspaceFactory.create(
portfolio = PortfolioFactory.create(
owner=owner,
applications=[
{
@@ -39,11 +39,11 @@ def test_can_only_update_name_and_description():
}
],
)
application = Applications.get(owner, workspace, workspace.applications[0].id)
application = Applications.get(owner, portfolio, portfolio.applications[0].id)
env_name = application.environments[0].name
Applications.update(
owner,
workspace,
portfolio,
application,
{
"name": "New Name",