2019-06-07 23:33:56 +00:00
|
|
|
require "inspec/fetcher"
|
|
|
|
|
2016-03-17 22:00:55 +00:00
|
|
|
module Fetchers
|
|
|
|
class Mock < Inspec.fetcher(1)
|
2019-06-11 22:24:35 +00:00
|
|
|
name "mock"
|
2016-03-17 22:00:55 +00:00
|
|
|
priority 0
|
|
|
|
|
|
|
|
def self.resolve(target)
|
|
|
|
return nil unless target.is_a? Hash
|
2019-07-09 00:20:30 +00:00
|
|
|
|
2016-03-17 22:00:55 +00:00
|
|
|
new(target)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(data)
|
|
|
|
@data = data
|
|
|
|
end
|
|
|
|
|
2016-09-08 09:11:44 +00:00
|
|
|
def fetch(_path)
|
|
|
|
archive_path
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
|
2016-09-08 09:11:44 +00:00
|
|
|
def archive_path
|
|
|
|
{ mock: @data }
|
|
|
|
end
|
|
|
|
|
|
|
|
def resolved_source
|
|
|
|
{ mock_fetcher: true }
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
2016-09-20 10:36:23 +00:00
|
|
|
|
|
|
|
def cache_key
|
2019-06-11 22:24:35 +00:00
|
|
|
""
|
2016-09-20 10:36:23 +00:00
|
|
|
end
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
end
|