class Fog::OpenStack::Introspection::Mock
Public Class Methods
data()
click to toggle source
# File lib/fog/openstack/introspection.rb, line 44 def self.data @data ||= Hash.new do |hash, key| # Introspection data is *huge* we load it from a yaml file file = "test/fixtures/introspection.yaml" hash[key] = YAML.load(File.read(file)) end end
new(options = {})
click to toggle source
# File lib/fog/openstack/introspection.rb, line 58 def initialize(options = {}) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86_400).iso8601 end
reset()
click to toggle source
# File lib/fog/openstack/introspection.rb, line 52 def self.reset @data = nil end
Public Instance Methods
abort_introspection(_node_id)
click to toggle source
# File lib/fog/openstack/introspection/requests/abort_introspection.rb, line 16 def abort_introspection(_node_id) response = Excon::Response.new response.status = 202 response.body = "" response end
create_introspection(_node_id, _options = {})
click to toggle source
# File lib/fog/openstack/introspection/requests/create_introspection.rb, line 26 def create_introspection(_node_id, _options = {}) response = Excon::Response.new response.status = 202 response.body = "" response end
create_rules(_)
click to toggle source
# File lib/fog/openstack/introspection/requests/create_rules.rb, line 28 def create_rules(_) response = Excon::Response.new response.status = 200 response.body = {"rules" => data[:rules].first} response end
data()
click to toggle source
# File lib/fog/openstack/introspection.rb, line 63 def data self.class.data[@openstack_username] end
delete_rules(_rule_id)
click to toggle source
# File lib/fog/openstack/introspection/requests/delete_rules.rb, line 15 def delete_rules(_rule_id) response = Excon::Response.new response.status = 204 response end
delete_rules_all()
click to toggle source
# File lib/fog/openstack/introspection/requests/delete_rules_all.rb, line 15 def delete_rules_all response = Excon::Response.new response.status = 204 response end
get_introspection(_node_id)
click to toggle source
# File lib/fog/openstack/introspection/requests/get_introspection.rb, line 15 def get_introspection(_node_id) response = Excon::Response.new response.status = 200 response.body = {"error" => "null", "finished" => "true"} response end
get_introspection_details(_node_id)
click to toggle source
# File lib/fog/openstack/introspection/requests/get_introspection_details.rb, line 15 def get_introspection_details(_node_id) response = Excon::Response.new response.status = 200 response.body = {"data" => data[:introspection_data]} response end
get_rules(_rule_id)
click to toggle source
# File lib/fog/openstack/introspection/requests/get_rules.rb, line 15 def get_rules(_rule_id) response = Excon::Response.new response.status = 200 response.body = {"rules" => data[:rules].first} response end
list_rules()
click to toggle source
# File lib/fog/openstack/introspection/requests/list_rules.rb, line 15 def list_rules response = Excon::Response.new response.status = 200 response.body = {"rules" => data[:rules].first} response end
reset_data()
click to toggle source
# File lib/fog/openstack/introspection.rb, line 67 def reset_data self.class.data.delete(@openstack_username) end