def test_with_already_provisioned_env(self, session): self.create_portfolio_with_clins([(self.YESTERDAY, self.TOMORROW)], env_data={"cloud_id": uuid4().hex}) assert len(Environments.get_environments_pending_creation( self.NOW)) == 0
def test_with_future_clins(self, session): self.create_portfolio_with_clins([(self.TOMORROW, self.TOMORROW)]) assert len(Environments.get_environments_pending_creation( self.NOW)) == 0
def test_with_expired_clins(self, session): self.create_portfolio_with_clins([(self.YESTERDAY, self.YESTERDAY)]) assert len(Environments.get_environments_pending_creation( self.NOW)) == 0
def test_with_active_clins(self, session): portfolio = self.create_portfolio_with_clins([(self.YESTERDAY, self.TOMORROW)]) Environments.get_environments_pending_creation( self.NOW) == [portfolio.applications[0].environments[0].id]
def dispatch_create_environment(self): for environment_id in Environments.get_environments_pending_creation( pendulum.now()): create_environment.delay(environment_id=environment_id)