foreman_openscap 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/compliance/arf_reports_controller.rb +15 -6
- data/app/controllers/api/v2/compliance/policies_controller.rb +4 -2
- data/app/controllers/api/v2/compliance/scap_contents_controller.rb +3 -2
- data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +3 -2
- data/app/controllers/arf_reports_controller.rb +4 -4
- data/app/controllers/policies_controller.rb +6 -5
- data/app/controllers/scap_contents_controller.rb +3 -3
- data/app/helpers/arf_report_dashboard_helper.rb +1 -1
- data/app/helpers/arf_reports_helper.rb +8 -8
- data/app/helpers/compliance_dashboard_helper.rb +0 -2
- data/app/helpers/compliance_hosts_helper.rb +7 -8
- data/app/helpers/policies_helper.rb +18 -18
- data/app/helpers/policy_dashboard_helper.rb +3 -3
- data/app/lib/proxy_api/available_proxy.rb +2 -2
- data/app/lib/proxy_api/openscap.rb +1 -1
- data/app/mailers/foreman_openscap/policy_mailer.rb +0 -2
- data/app/models/concerns/foreman_openscap/compliance_status_scoped_search.rb +7 -7
- data/app/models/concerns/foreman_openscap/data_stream_content.rb +1 -1
- data/app/models/concerns/foreman_openscap/host_extensions.rb +16 -6
- data/app/models/concerns/foreman_openscap/openscap_proxy_extensions.rb +1 -1
- data/app/models/foreman_openscap/arf_report.rb +5 -5
- data/app/models/foreman_openscap/policy.rb +6 -6
- data/app/models/foreman_openscap/scap_content.rb +2 -2
- data/app/models/foreman_openscap/tailoring_file.rb +1 -1
- data/app/services/foreman_openscap/arf_report_status_calculator.rb +0 -1
- data/app/services/foreman_openscap/host_report_dashboard/data.rb +2 -3
- data/app/services/foreman_openscap/openscap_proxy_version_check.rb +0 -1
- data/app/services/foreman_openscap/policy_dashboard/data.rb +7 -6
- data/app/services/foreman_openscap/report_dashboard/data.rb +1 -0
- data/app/views/api/v2/compliance/common/_loc.json.rabl +1 -1
- data/app/views/api/v2/compliance/common/_org.json.rabl +1 -1
- data/app/views/api/v2/compliance/policies/base.json.rabl +1 -1
- data/app/views/arf_reports/_list.html.erb +1 -1
- data/app/views/arf_reports/delete_multiple.html.erb +1 -1
- data/app/views/arf_reports/welcome.html.erb +12 -0
- data/app/views/compliance_hosts/show.html.erb +3 -1
- data/app/views/policy_dashboard/_policy_reports.html.erb +1 -1
- data/app/views/scap_contents/_list.html.erb +1 -1
- data/app/views/smart_proxies/_openscap_spool.html.erb +1 -1
- data/app/views/tailoring_files/_list.html.erb +1 -1
- data/config/routes.rb +9 -11
- data/db/migrate/20141015115511_add_arf_report_unique_constraint.rb +1 -1
- data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +2 -3
- data/db/migrate/20141206211151_create_scaptimony_assets_policies.rb +1 -1
- data/db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb +1 -1
- data/db/migrate/20150821100137_migrate_from_scaptimony.rb +1 -1
- data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +0 -1
- data/db/migrate/20161223153249_add_permissions_to_arf_report.rb +2 -2
- data/db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb +6 -0
- data/lib/foreman_openscap/bulk_upload.rb +1 -1
- data/lib/foreman_openscap/engine.rb +54 -56
- data/lib/foreman_openscap/version.rb +1 -1
- data/lib/tasks/foreman_openscap_tasks.rake +11 -2
- data/locale/de/foreman_openscap.po +52 -13
- data/locale/en_GB/foreman_openscap.po +52 -13
- data/locale/es/foreman_openscap.po +52 -13
- data/locale/foreman_openscap.pot +140 -90
- data/locale/fr/foreman_openscap.po +52 -13
- data/locale/gl/foreman_openscap.po +52 -13
- data/locale/it/foreman_openscap.po +52 -13
- data/locale/ja/foreman_openscap.po +52 -13
- data/locale/ko/foreman_openscap.po +52 -13
- data/locale/pt_BR/foreman_openscap.po +52 -13
- data/locale/ru/foreman_openscap.po +52 -13
- data/locale/sv_SE/foreman_openscap.po +52 -13
- data/locale/zh_CN/foreman_openscap.po +52 -13
- data/locale/zh_TW/foreman_openscap.po +52 -13
- data/test/factories/arf_report_factory.rb +1 -1
- data/test/factories/asset_factory.rb +2 -2
- data/test/factories/compliance_host_factory.rb +2 -2
- data/test/factories/compliance_log_factory.rb +1 -1
- data/test/factories/policy_arf_report_factory.rb +1 -1
- data/test/factories/policy_factory.rb +3 -3
- data/test/factories/scap_content_related.rb +2 -2
- data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +28 -9
- data/test/functional/api/v2/compliance/policies_controller_test.rb +16 -16
- data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +8 -9
- data/test/functional/api/v2/compliance/tailoring_files_controller_test.rb +10 -11
- data/test/functional/arf_reports_controller_test.rb +4 -4
- data/test/functional/openscap_proxies_controller_test.rb +5 -3
- data/test/functional/tailoring_files_controller_test.rb +1 -1
- data/test/test_plugin_helper.rb +7 -7
- data/test/unit/arf_report_status_calculator_test.rb +0 -1
- data/test/unit/arf_report_test.rb +50 -50
- data/test/unit/compliance_status_test.rb +13 -13
- data/test/unit/concerns/host_extensions_test.rb +38 -22
- data/test/unit/concerns/openscap_proxy_extenstions_test.rb +5 -6
- data/test/unit/message_cleaner_test.rb +7 -7
- data/test/unit/openscap_host_test.rb +13 -13
- data/test/unit/policy_mailer_test.rb +12 -12
- data/test/unit/policy_test.rb +30 -30
- data/test/unit/scap_content_test.rb +4 -4
- data/test/unit/services/report_dashboard/data_test.rb +6 -6
- data/test/unit/services/tailoring_files_proxy_check_test.rb +1 -1
- metadata +4 -2
@@ -25,7 +25,7 @@ class ScapContentTest < ActiveSupport::TestCase
|
|
25
25
|
|
26
26
|
test 'proxy_url should return the first available proxy it finds' do
|
27
27
|
available_proxy = SmartProxy.with_features('Openscap').first
|
28
|
-
unavailable_proxy =
|
28
|
+
unavailable_proxy = FactoryBot.create(:smart_proxy, :url => 'http://proxy.example.com:8443', :features => [FactoryBot.create(:feature, :name => 'Openscap')])
|
29
29
|
available_proxy.stubs(:proxy_url).returns(available_proxy.url)
|
30
30
|
unavailable_proxy.stubs(:proxy_url).returns(nil)
|
31
31
|
scap_content = ForemanOpenscap::ScapContent.new(:title => 'Fedora', :scap_file => @scap_file)
|
@@ -34,15 +34,15 @@ class ScapContentTest < ActiveSupport::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'should update profile title when fetching profiles from proxy' do
|
37
|
-
scap_content =
|
37
|
+
scap_content = FactoryBot.create(:scap_content)
|
38
38
|
scap_content.stubs(:fetch_profiles).returns({ "xccdf.test.profile" => "Changed title" })
|
39
|
-
scap_profile =
|
39
|
+
scap_profile = FactoryBot.create(:scap_content_profile, :scap_content => scap_content, :profile_id => 'xccdf.test.profile', :title => "Original title")
|
40
40
|
scap_content.create_profiles
|
41
41
|
assert_equal scap_profile.reload.title, 'Changed title'
|
42
42
|
end
|
43
43
|
|
44
44
|
test 'should create profile when fetching profiles from proxy' do
|
45
|
-
scap_content =
|
45
|
+
scap_content = FactoryBot.create(:scap_content)
|
46
46
|
scap_content.stubs(:fetch_profiles).returns({ "xccdf.test.profile" => "My title" })
|
47
47
|
scap_content.create_profiles
|
48
48
|
assert scap_content.reload.scap_content_profiles.where(:title => 'My title').first
|
@@ -2,18 +2,18 @@ require 'test_plugin_helper'
|
|
2
2
|
|
3
3
|
class DataTest < ActiveSupport::TestCase
|
4
4
|
setup do
|
5
|
-
@host =
|
6
|
-
@arf =
|
7
|
-
@source =
|
5
|
+
@host = FactoryBot.create(:compliance_host)
|
6
|
+
@arf = FactoryBot.create(:arf_report, :host_id => @host.id)
|
7
|
+
@source = FactoryBot.create(:source)
|
8
8
|
@failed = []
|
9
9
|
@passed = []
|
10
10
|
3.times do
|
11
|
-
@failed <<
|
11
|
+
@failed << FactoryBot.create(:compliance_log, :report_id => @arf.id, :source => @source)
|
12
12
|
end
|
13
13
|
2.times do
|
14
|
-
@passed <<
|
14
|
+
@passed << FactoryBot.create(:compliance_log, :report_id => @arf.id, :result => "pass", :source => @source)
|
15
15
|
end
|
16
|
-
@othered = [
|
16
|
+
@othered = [FactoryBot.create(:compliance_log, :report_id => @arf.id, :result => "unknown", :source => @source)]
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'should fetch data' do
|
@@ -19,7 +19,7 @@ class TailoringFilesProxyCheckTest < ActiveSupport::TestCase
|
|
19
19
|
|
20
20
|
test 'should fail when proxy cannot be reached' do
|
21
21
|
ProxyStatus::Version.any_instance.stubs(:version).raises(Foreman::WrappedException.new(nil, 'test message'))
|
22
|
-
ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:get_openscap_proxies).returns([
|
22
|
+
ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:get_openscap_proxies).returns([FactoryBot.create(:openscap_proxy)])
|
23
23
|
check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
|
24
24
|
refute check.pass?
|
25
25
|
refute check.message.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slukasik@redhat.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- app/views/arf_reports/index.html.erb
|
129
129
|
- app/views/arf_reports/show.html.erb
|
130
130
|
- app/views/arf_reports/show_html.html.erb
|
131
|
+
- app/views/arf_reports/welcome.html.erb
|
131
132
|
- app/views/compliance_hosts/_compliance_status.erb
|
132
133
|
- app/views/compliance_hosts/show.html.erb
|
133
134
|
- app/views/dashboard/_compliance_host_reports_widget.html.erb
|
@@ -218,6 +219,7 @@ files:
|
|
218
219
|
- db/migrate/20170821081205_rename_mail_notification.foreman_openscap.rb
|
219
220
|
- db/migrate/20170830221751_add_index_to_logs_result.rb
|
220
221
|
- db/migrate/20171011134112_remove_arf_reports_without_policy.rb
|
222
|
+
- db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb
|
221
223
|
- db/seeds.d/75-job_templates.rb
|
222
224
|
- db/seeds.d/openscap_feature.rb
|
223
225
|
- db/seeds.d/openscap_policy_notification.rb
|