Skip to content

Commit

Permalink
Use common fix_expires_at_token
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Jun 6, 2023
1 parent fb5a506 commit b411a7a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }
Dir[ManageIQ::Providers::Openstack::Engine.root.join("spec/support/**/*.rb")].sort.each { |f| require f }

require "manageiq/providers/ibm_power_vc"

Expand All @@ -13,19 +14,13 @@ def sanitizer(interaction)
interaction.response.body.gsub!(/"host": "[^"]*?"/, '"host": "powervc.local"')
end

def fix_token_expires_at(interaction)
data = JSON.parse(interaction.response.body)
data["token"]["expires_at"] = "9999-12-31T23:59:59.999999Z"
interaction.response.body = data.to_json.force_encoding('ASCII-8BIT')
end

VCR.configure do |config|
config.ignore_hosts 'codeclimate.com' if ENV['CI']
config.cassette_library_dir = File.join(ManageIQ::Providers::IbmPowerVc::Engine.root, 'spec/vcr_cassettes')

config.before_record do |i|
sanitizer(i)
fix_token_expires_at(i) if i.request.uri.end_with?("v3/auth/tokens")
fix_token_expires_at_interaction(i)
end

config.define_cassette_placeholder(Rails.application.secrets.ibm_power_vc_defaults[:hostname]) do
Expand Down

0 comments on commit b411a7a

Please sign in to comment.