def test_generate_s3_bucket(): """CLI - Terraform Generate S3 Bucket """ bucket = generate.generate_s3_bucket(bucket='unit.test.bucket', logging='my.s3-logging.bucket', force_destroy=True) required_keys = { 'bucket', 'acl', 'force_destroy', 'versioning', 'logging', 'server_side_encryption_configuration', 'policy' } assert_equal(type(bucket), dict) assert_equal(bucket['bucket'], 'unit.test.bucket') assert_equal(set(bucket.keys()), required_keys)
def test_generate_s3_bucket_lifecycle(): """CLI - Terraform Generate S3 Bucket with Lifecycle""" bucket = generate.generate_s3_bucket( bucket='unit.test.bucket', logging='my.s3-logging.bucket', force_destroy=False, lifecycle_rule={ 'prefix': 'logs/', 'enabled': True, 'transition': {'days': 30, 'storage_class': 'GLACIER'} } ) assert_equal(bucket['lifecycle_rule']['prefix'], 'logs/') assert_equal(bucket['force_destroy'], False) assert_equal(type(bucket['lifecycle_rule']), dict) assert_equal(type(bucket['versioning']), dict)