Sha256: 8918945f52c07ac8d485d022482b2bf731d9b0f1515665473112a89b847d817b
Contents?: true
Size: 1.33 KB
Versions: 25
Compression:
Stored size: 1.33 KB
Contents
require 'test_helper' require 'smart_proxy_openscap' require 'smart_proxy_openscap/openscap_api' ENV['RACK_ENV'] = 'test' class FetchTailoringApiTest < Test::Unit::TestCase include Rack::Test::Methods def setup @foreman_url = 'https://foreman.example.com' Proxy::SETTINGS.stubs(:foreman_url).returns(@foreman_url) @results_path = ("#{Dir.getwd}/test/test_run_files") FileUtils.mkdir_p(@results_path) Proxy::OpenSCAP::Plugin.settings.stubs(:tailoring_dir).returns(@results_path) @tailoring_file = File.new("#{Dir.getwd}/test/data/tailoring.xml").read @digest = Digest::SHA256.hexdigest @tailoring_file @policy_id = 1 end def teardown FileUtils.rm_rf(Dir.glob("#{@results_path}/*")) end def app ::Proxy::OpenSCAP::Api.new end def test_get_tailoring_file_from_file FileUtils.mkdir("#{@results_path}/#{@policy_id}") FileUtils.cp("#{Dir.getwd}/test/data/tailoring.xml", "#{@results_path}/#{@policy_id}/#{@policy_id}_#{@digest}.xml") get "/policies/#{@policy_id}/tailoring/#{@digest}" assert_equal("application/xml;charset=utf-8", last_response.header["Content-Type"], "Response header should be application/xml") assert_equal(@tailoring_file.length, last_response.length, "Scap content should be equal") assert(last_response.successful?, "Response should be success") end end
Version data entries
25 entries across 25 versions & 1 rubygems