Skip to content

Commit

Permalink
fixes to arf reports functional tests, to respect openscap_proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomizadok committed May 24, 2016
1 parent 65230d5 commit 05ad882
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -4,13 +4,13 @@ module OpenscapProxyExtensions

included do
belongs_to :openscap_proxy, :class_name => "SmartProxy"
attr_accessible :openscap_proxy
attr_accessible :openscap_proxy_id
end

def openscap_proxy_api
return @openscap_api if @openscap_api
proxy_url = openscap_proxy.url
fail(_("No openscap proxy found for %s") % name) unless proxy_url
proxy_url = openscap_proxy.url if openscap_proxy
fail(_("No openscap proxy found for %s") % id) unless proxy_url
@openscap_api = ::ProxyAPI::Openscap.new(:url => proxy_url)
end
end
Expand Down
1 change: 1 addition & 0 deletions test/factories/compliance_host_factory.rb
Expand Up @@ -3,6 +3,7 @@
sequence(:name) { |n| "host#{n}" }
sequence(:hostname) { |n| "hostname#{n}" }
root_pass 'xybxa6JUkz63w'
openscap_proxy FactoryGirl.build(:smart_proxy, :url => "http://test.org:8080")
policies []
asset nil
end
Expand Down
3 changes: 1 addition & 2 deletions test/functional/arf_reports_controller_test.rb
Expand Up @@ -4,10 +4,9 @@ class ArfReportsControllerTest < ActionController::TestCase

test "should delete selected reports" do
host = FactoryGirl.create(:compliance_host)
openscap_proxy = ::ProxyAPI::Openscap.new(:url => "http://test.org:8080")
ForemanOpenscap::Helper.stubs(:find_name_or_uuid_by_host)
::ProxyAPI::Openscap.any_instance.stubs(:destroy_report).returns(true)
ForemanOpenscap::ArfReport.any_instance.stubs(:proxy).returns(openscap_proxy)
ForemanOpenscap::ArfReport.any_instance.stubs(:openscap_proxy).returns(host.openscap_proxy)
arf_reports = []
3.times do
arf_reports << FactoryGirl.create(:arf_report, :host_id => host.id)
Expand Down

0 comments on commit 05ad882

Please sign in to comment.