-
Notifications
You must be signed in to change notification settings - Fork 212
/
NeptuneDBClusterStorageEncryptedRule_spec.rb
51 lines (39 loc) · 1.97 KB
/
NeptuneDBClusterStorageEncryptedRule_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'spec_helper'
require 'cfn-model'
require 'cfn-nag/custom_rules/NeptuneDBClusterStorageEncryptedRule'
describe NeptuneDBClusterStorageEncryptedRule do
context 'Neptune database storage without encryption' do
it 'returns offending logical resource id' do
cfn_model = CfnParser.new.parse read_test_template(
'json/neptune/with_no_encryption.json'
)
actual_logical_resource_ids = NeptuneDBClusterStorageEncryptedRule.new.audit_impl cfn_model
expected_logical_resource_ids = %w[NeptuneDBCluster]
expect(actual_logical_resource_ids).to eq expected_logical_resource_ids
end
end
context 'Neptune database storage with encryption' do
it 'returns empty list' do
cfn_model = CfnParser.new.parse read_test_template('json/neptune/with_encryption.json')
actual_logical_resource_ids = NeptuneDBClusterStorageEncryptedRule.new.audit_impl cfn_model
expected_logical_resource_ids = []
expect(actual_logical_resource_ids).to eq expected_logical_resource_ids
end
end
context 'Neptune database storage encryption set to false string' do
it 'returns offending logical resource id' do
cfn_model = CfnParser.new.parse read_test_template('json/neptune/with_encryption_false_string.json')
actual_logical_resource_ids = NeptuneDBClusterStorageEncryptedRule.new.audit_impl cfn_model
expected_logical_resource_ids = %w[NeptuneDBCluster]
expect(actual_logical_resource_ids).to eq expected_logical_resource_ids
end
end
context 'Neptune database storage encryption set to false boolean' do
it 'returns offending logical resource id' do
cfn_model = CfnParser.new.parse read_test_template('json/neptune/with_encryption_false_boolean.json')
actual_logical_resource_ids = NeptuneDBClusterStorageEncryptedRule.new.audit_impl cfn_model
expected_logical_resource_ids = %w[NeptuneDBCluster]
expect(actual_logical_resource_ids).to eq expected_logical_resource_ids
end
end
end