def _create_deployment(self, job_name, job): from foundations_contrib.job_source_bundle import JobSourceBundle deployment_constructor, constructor_args, constructor_kwargs = self._deployment_constructor_and_args_and_kwargs() job_source_bundle = JobSourceBundle.for_deployment() return deployment_constructor(job_name, job, job_source_bundle, *constructor_args, **constructor_kwargs)
def _make_deployment(self, stage, **kwargs): from foundations import Job from foundations_contrib.job_source_bundle import JobSourceBundle from foundations_contrib.bucket_job_deployment import BucketJobDeployment from uuid import uuid4 from integration.config import make_code_bucket, make_result_bucket job = Job(stage, **kwargs) job_name = str(uuid4()) source_bundle = JobSourceBundle.for_deployment() return BucketJobDeployment(job_name, job, source_bundle, make_code_bucket(), make_result_bucket())
def test_for_deployment_returns_job_source_bundle(self): self.assertIsInstance(JobSourceBundle.for_deployment(), JobSourceBundle)
def test_for_deployment_creates_job_source_bundle_with_correct_arguments( self, mock_job_source_bundle): self.mock_uuid4.return_value = self.fake_uuid JobSourceBundle.for_deployment() mock_job_source_bundle.assert_called_with(self.fake_uuid, self.temp_directory + '/')