示例#1
0
    def test_all_args(self, package_command_context, click_mock):

        context_mock = Mock()
        package_command_context.return_value.__enter__.return_value = context_mock

        do_cli(
            template_file=self.template_file,
            s3_bucket=self.s3_bucket,
            s3_prefix=self.s3_prefix,
            kms_key_id=self.kms_key_id,
            output_template_file=self.output_template_file,
            use_json=self.use_json,
            force_upload=self.force_upload,
            metadata=self.metadata,
            region=self.region,
            profile=self.profile,
        )

        package_command_context.assert_called_with(
            template_file=self.template_file,
            s3_bucket=self.s3_bucket,
            s3_prefix=self.s3_prefix,
            kms_key_id=self.kms_key_id,
            output_template_file=self.output_template_file,
            use_json=self.use_json,
            force_upload=self.force_upload,
            metadata=self.metadata,
            region=self.region,
            profile=self.profile,
        )

        context_mock.run.assert_called_with()
        self.assertEqual(context_mock.run.call_count, 1)
示例#2
0
 def test_resolve_s3_and_s3_bucket_both_set(self):
     with self.assertRaises(PackageResolveS3AndS3SetError):
         do_cli(
             template_file=self.template_file,
             s3_bucket=self.s3_bucket,
             s3_prefix=self.s3_prefix,
             kms_key_id=self.kms_key_id,
             output_template_file=self.output_template_file,
             use_json=self.use_json,
             force_upload=self.force_upload,
             metadata=self.metadata,
             region=self.region,
             profile=self.profile,
             resolve_s3=True,
         )
示例#3
0
 def test_resolve_s3_and_s3_bucket_both_not_set(self):
     with self.assertRaises(PackageResolveS3AndS3NotSetError):
         do_cli(
             template_file=self.template_file,
             s3_bucket=None,
             s3_prefix=self.s3_prefix,
             kms_key_id=self.kms_key_id,
             output_template_file=self.output_template_file,
             use_json=self.use_json,
             force_upload=self.force_upload,
             no_progressbar=self.no_progressbar,
             metadata=self.metadata,
             region=self.region,
             profile=self.profile,
             resolve_s3=False,
             signing_profiles=self.signing_profiles,
         )
示例#4
0
    def test_all_args_resolve_s3(self, mock_managed_stack, package_command_context, click_mock):
        context_mock = Mock()
        package_command_context.return_value.__enter__.return_value = context_mock
        mock_managed_stack.return_value = "managed-s3-bucket"

        do_cli(
            template_file=self.template_file,
            s3_bucket=None,
            s3_prefix=self.s3_prefix,
            image_repository=self.image_repository,
            image_repositories=self.image_repositories,
            kms_key_id=self.kms_key_id,
            output_template_file=self.output_template_file,
            use_json=self.use_json,
            force_upload=self.force_upload,
            no_progressbar=self.no_progressbar,
            metadata=self.metadata,
            region=self.region,
            profile=self.profile,
            resolve_s3=True,
            signing_profiles=self.signing_profiles,
        )

        package_command_context.assert_called_with(
            template_file=self.template_file,
            s3_bucket="managed-s3-bucket",
            s3_prefix=self.s3_prefix,
            image_repository=self.image_repository,
            image_repositories=self.image_repositories,
            kms_key_id=self.kms_key_id,
            output_template_file=self.output_template_file,
            use_json=self.use_json,
            force_upload=self.force_upload,
            no_progressbar=self.no_progressbar,
            metadata=self.metadata,
            region=self.region,
            profile=self.profile,
            signing_profiles=self.signing_profiles,
        )

        context_mock.run.assert_called_with()
        self.assertEqual(context_mock.run.call_count, 1)