diff options
author | Thore Bödecker <me@foxxx0.de> | 2020-06-30 17:41:09 +0200 |
---|---|---|
committer | Thore Bödecker <me@foxxx0.de> | 2020-06-30 18:05:52 +0200 |
commit | 1fc98345fae1cf48e1891b59e2faf4823246aa76 (patch) | |
tree | 0d7b70fc52d707a36c94360b72da2e2dd728d7fb /spec/type_aliases | |
parent | 856eca997158141e084b9e8c2002d7491a4720a1 (diff) | |
download | puppet-ferm-1fc98345fae1cf48e1891b59e2faf4823246aa76.tar.gz puppet-ferm-1fc98345fae1cf48e1891b59e2faf4823246aa76.tar.bz2 |
add type_aliases tests for the other ferm types
Diffstat (limited to 'spec/type_aliases')
-rw-r--r-- | spec/type_aliases/actions_spec.rb | 46 | ||||
-rw-r--r-- | spec/type_aliases/policies_spec.rb | 39 | ||||
-rw-r--r-- | spec/type_aliases/protocols_spec.rb | 46 | ||||
-rw-r--r-- | spec/type_aliases/tables_spec.rb | 39 |
4 files changed, 170 insertions, 0 deletions
diff --git a/spec/type_aliases/actions_spec.rb b/spec/type_aliases/actions_spec.rb new file mode 100644 index 0000000..9c42e12 --- /dev/null +++ b/spec/type_aliases/actions_spec.rb @@ -0,0 +1,46 @@ +# rubocop:disable Style/WordArray, Style/TrailingCommaInLiteral +require 'spec_helper' + +describe 'Ferm::Actions' do + describe 'valid values' do + [ + 'RETURN', + 'ACCEPT', + 'DROP', + 'REJECT', + 'NOTRACK', + 'LOG', + 'MARK', + 'DNAT', + 'SNAT', + 'MASQUERADE', + 'REDIRECT', + 'MYFANCYCUSTOMCHAINNAMEISALSOVALID', + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + + describe 'invalid values' do + context 'with garbage inputs' do + [ + # :symbol, # this should not match but seems liks String[1] allows it? + # nil, # this should not match but seems liks String[1] allows it? + '', + true, + false, + ['meep', 'meep'], + 65_538, + [95_000, 67_000], + {}, + { 'foo' => 'bar' }, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end diff --git a/spec/type_aliases/policies_spec.rb b/spec/type_aliases/policies_spec.rb new file mode 100644 index 0000000..bc45423 --- /dev/null +++ b/spec/type_aliases/policies_spec.rb @@ -0,0 +1,39 @@ +# rubocop:disable Style/WordArray, Style/TrailingCommaInLiteral +require 'spec_helper' + +describe 'Ferm::Policies' do + describe 'valid values' do + [ + 'ACCEPT', + 'DROP', + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + + describe 'invalid values' do + context 'with garbage inputs' do + [ + 'RETURN', + 'REJECT', + 'foobar', + :symbol, + nil, + '', + true, + false, + ['meep', 'meep'], + 65_538, + [95_000, 67_000], + {}, + { 'foo' => 'bar' }, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end diff --git a/spec/type_aliases/protocols_spec.rb b/spec/type_aliases/protocols_spec.rb new file mode 100644 index 0000000..a067b69 --- /dev/null +++ b/spec/type_aliases/protocols_spec.rb @@ -0,0 +1,46 @@ +# rubocop:disable Style/WordArray, Style/TrailingCommaInLiteral +require 'spec_helper' + +describe 'Ferm::Protocols' do + describe 'valid values' do + [ + 'icmp', + 'tcp', + 'udp', + 'udplite', + 'icmpv6', + 'esp', + 'ah', + 'sctp', + 'mh', + 'all', + ['icmp', 'tcp', 'udp'], + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + + describe 'invalid values' do + context 'with garbage inputs' do + [ + :symbol, + nil, + 'foobar', + '', + true, + false, + ['meep', 'meep'], + 65_538, + [95_000, 67_000], + {}, + { 'foo' => 'bar' }, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end diff --git a/spec/type_aliases/tables_spec.rb b/spec/type_aliases/tables_spec.rb new file mode 100644 index 0000000..eb02877 --- /dev/null +++ b/spec/type_aliases/tables_spec.rb @@ -0,0 +1,39 @@ +# rubocop:disable Style/WordArray, Style/TrailingCommaInLiteral +require 'spec_helper' + +describe 'Ferm::Tables' do + describe 'valid values' do + [ + 'raw', + 'mangle', + 'nat', + 'filter', + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + + describe 'invalid values' do + context 'with garbage inputs' do + [ + :symbol, + nil, + 'foobar', + '', + true, + false, + ['meep', 'meep'], + 65_538, + [95_000, 67_000], + {}, + { 'foo' => 'bar' }, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end |