mirror of
https://github.com/inspec/inspec
synced 2024-12-23 03:23:27 +00:00
1bb565c708
* Initial commit of skeletal resource aws_sns_topics * Adds clarification in documentation * Adds functionality for calling the next token returned from aws api. * Wraps api calls in the catch_aws_errs method Signed-off-by: Matthew Dromazos <dromazmj@dukes.jmu.edu>
54 lines
1.8 KiB
Ruby
54 lines
1.8 KiB
Ruby
require 'helper'
|
|
|
|
# MSTB = MockSnsTopicsBackend
|
|
# Abbreviation not used outside this file
|
|
|
|
#=============================================================================#
|
|
# Constructor Tests
|
|
#=============================================================================#
|
|
class AwsSnsTopicsConstructor < Minitest::Test
|
|
def setup
|
|
AwsSnsTopics::BackendFactory.select(AwsMSTB::Basic)
|
|
end
|
|
|
|
def test_constructor_no_args_ok
|
|
AwsSnsTopics.new
|
|
end
|
|
|
|
def test_constructor_reject_unknown_resource_params
|
|
assert_raises(ArgumentError) { AwsSnsTopics.new(bla: 'blabla') }
|
|
end
|
|
end
|
|
|
|
#=============================================================================#
|
|
# Properties
|
|
#=============================================================================#
|
|
class AwsSnsTopicsProperties < Minitest::Test
|
|
def setup
|
|
AwsSnsTopics::BackendFactory.select(AwsMSTB::Basic)
|
|
end
|
|
|
|
def test_property_topics_arns
|
|
basic = AwsSnsTopics.new
|
|
assert_kind_of(Array, basic.topic_arns)
|
|
assert(basic.topic_arns.include?('arn:aws:sns:us-east-1:212312313:test-topic-01'))
|
|
assert(basic.topic_arns.include?('arn:aws:sns:us-east-1:123123129:test-topic-02'))
|
|
refute(basic.topic_arns.include?(nil))
|
|
end
|
|
end
|
|
|
|
#=============================================================================#
|
|
# Test Fixtures
|
|
#=============================================================================#
|
|
module AwsMSTB
|
|
class Basic < AwsBackendBase
|
|
def list_topics(query = {})
|
|
topics = OpenStruct.new({
|
|
:topics => [
|
|
OpenStruct.new({topic_arn: 'arn:aws:sns:us-east-1:212312313:test-topic-01'}),
|
|
OpenStruct.new({topic_arn: 'arn:aws:sns:us-east-1:123123129:test-topic-02'})
|
|
]
|
|
})
|
|
end
|
|
end
|
|
end
|