Sha256: 0a6654b8e475984772445728e53c69a01c3cd85b8f07b1508c4f7b41c489c372

Contents?: true

Size: 888 Bytes

Versions: 11

Compression:

Stored size: 888 Bytes

Contents

require 'test_plugin_helper'

class DataTest < ActiveSupport::TestCase
  setup do
    @host = FactoryGirl.create(:compliance_host)
    @arf = FactoryGirl.create(:arf_report, :host_id => @host.id)
    @source = FactoryGirl.create(:source)
    @failed = []
    @passed = []
    3.times do
      @failed << FactoryGirl.create(:compliance_log, :report_id => @arf.id, :source => @source)
    end
    2.times do
      @passed << FactoryGirl.create(:compliance_log, :report_id => @arf.id, :result => "pass", :source => @source)
    end
    @othered = [FactoryGirl.create(:compliance_log, :report_id => @arf.id, :result => "unknown", :source => @source)]
  end

  test 'should fetch data' do
    report_data = ForemanOpenscap::ReportDashboard::Data.new().report
    assert_equal 3, report_data[:failed]
    assert_equal 2, report_data[:passed]
    assert_equal 1, report_data[:othered]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_openscap-0.7.1 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.7 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.7.0 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.6 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.5 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.4 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.3 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.2 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.1 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.6.0 test/unit/services/report_dashboard/data_test.rb
foreman_openscap-0.5.4 test/unit/services/report_dashboard/data_test.rb