Merge pull request #1062 from dod-ccpo/env-provisioning-task
Environment provisioning background jobs
This commit is contained in:
@@ -118,6 +118,7 @@ class PortfolioFactory(Base):
|
||||
with_applications = kwargs.pop("applications", [])
|
||||
owner = kwargs.pop("owner", UserFactory.create())
|
||||
members = kwargs.pop("members", [])
|
||||
with_task_orders = kwargs.pop("task_orders", [])
|
||||
|
||||
portfolio = super()._create(model_class, *args, **kwargs)
|
||||
|
||||
@@ -126,6 +127,11 @@ class PortfolioFactory(Base):
|
||||
for p in with_applications
|
||||
]
|
||||
|
||||
task_orders = [
|
||||
TaskOrderFactory.create(portfolio=portfolio, **to)
|
||||
for to in with_task_orders
|
||||
]
|
||||
|
||||
PortfolioRoleFactory.create(
|
||||
portfolio=portfolio,
|
||||
user=owner,
|
||||
@@ -154,6 +160,7 @@ class PortfolioFactory(Base):
|
||||
)
|
||||
|
||||
portfolio.applications = applications
|
||||
portfolio.task_orders = task_orders
|
||||
return portfolio
|
||||
|
||||
|
||||
@@ -185,6 +192,7 @@ class EnvironmentFactory(Base):
|
||||
|
||||
name = factory.Faker("domain_word")
|
||||
application = factory.SubFactory(ApplicationFactory)
|
||||
creator = factory.SubFactory(UserFactory)
|
||||
|
||||
@classmethod
|
||||
def _create(cls, model_class, *args, **kwargs):
|
||||
@@ -278,7 +286,7 @@ class TaskOrderFactory(Base):
|
||||
task_order = super()._create(model_class, *args, **kwargs)
|
||||
|
||||
for clin in create_clins:
|
||||
CLINFactory.create(task_order=task_order, number=clin)
|
||||
CLINFactory.create(task_order=task_order, **clin)
|
||||
|
||||
return task_order
|
||||
|
||||
|
Reference in New Issue
Block a user