mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
c04a98c9f8
* Initial commit of skeletal resource aws_route_tables * Fixes issues with documentation * Renames route table terraform resources to be more conventional * Removes tags terraform resources * Changes aws_route_table and aws_route_tables integration tests to use new terraform names * Removes unneeded data given in unit tests Signed-off-by: Matthew Dromazos <dromazmj@dukes.jmu.edu>
70 lines
1.7 KiB
Ruby
70 lines
1.7 KiB
Ruby
require 'helper'
|
|
|
|
class EmptyAwsRouteTablesTest < Minitest::Test
|
|
def setup
|
|
AwsRouteTables::BackendFactory.select(AwsMRtbB::Empty)
|
|
end
|
|
|
|
def test_constructor_no_args_ok
|
|
AwsRouteTables.new
|
|
end
|
|
|
|
def test_search_miss
|
|
refute AwsRouteTables.new.exists?
|
|
end
|
|
|
|
def test_constructor_reject_unknown_resource_params
|
|
assert_raises(ArgumentError) { AwsRouteTables.new(bla: 'blabla') }
|
|
end
|
|
end
|
|
|
|
class BasicAwsRouteTablesTest2 < Minitest::Test
|
|
def setup
|
|
AwsRouteTables::BackendFactory.select(AwsMRtbB::Basic)
|
|
end
|
|
|
|
def test_search_hit
|
|
assert AwsRouteTables.new.exists?
|
|
end
|
|
|
|
def test_property_vpc_ids
|
|
basic = AwsRouteTables.new
|
|
assert_kind_of(Array, basic.vpc_ids)
|
|
assert(basic.vpc_ids.include?('vpc-169f777e'))
|
|
assert(basic.vpc_ids.include?('vpc-169f777d'))
|
|
refute(basic.vpc_ids.include?(nil))
|
|
end
|
|
|
|
def test_property_route_table_ids
|
|
basic = AwsRouteTables.new
|
|
assert_kind_of(Array, basic.route_table_ids)
|
|
assert(basic.route_table_ids.include?('rtb-2c60ec44'))
|
|
assert(basic.route_table_ids.include?('rtb-58508630'))
|
|
refute(basic.route_table_ids.include?(nil))
|
|
end
|
|
end
|
|
|
|
# MRtbB = Mock Routetable Backend
|
|
module AwsMRtbB
|
|
class Empty < AwsBackendBase
|
|
def describe_route_tables(query)
|
|
OpenStruct.new(route_tables: [])
|
|
end
|
|
end
|
|
|
|
class Basic < AwsBackendBase
|
|
def describe_route_tables(query)
|
|
fixtures = [
|
|
OpenStruct.new({
|
|
route_table_id: 'rtb-2c60ec44',
|
|
vpc_id: 'vpc-169f777e'
|
|
}),
|
|
OpenStruct.new({
|
|
route_table_id: 'rtb-58508630',
|
|
vpc_id: 'vpc-169f777d'
|
|
})
|
|
]
|
|
OpenStruct.new({ route_tables: fixtures })
|
|
end
|
|
end
|
|
end
|