foreman_openscap 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +3 -3
  3. data/app/controllers/api/v2/compliance/policies_controller.rb +2 -2
  4. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +1 -1
  5. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +2 -2
  6. data/app/controllers/arf_reports_controller.rb +2 -2
  7. data/app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb +4 -7
  8. data/app/controllers/policies_controller.rb +3 -3
  9. data/app/controllers/policy_dashboard_controller.rb +1 -1
  10. data/app/controllers/scap_contents_controller.rb +2 -2
  11. data/app/controllers/tailoring_files_controller.rb +2 -2
  12. data/app/helpers/arf_reports_helper.rb +1 -1
  13. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +4 -11
  14. data/app/helpers/concerns/foreman_openscap/lookup_keys_helper_extensions.rb +2 -8
  15. data/app/helpers/policies_helper.rb +1 -1
  16. data/app/lib/proxy_api/openscap.rb +2 -3
  17. data/app/models/concerns/foreman_openscap/host_extensions.rb +19 -20
  18. data/app/models/foreman_openscap/arf_report.rb +8 -12
  19. data/app/views/scap_contents/_form.html.erb +1 -1
  20. data/app/views/tailoring_files/_form.html.erb +1 -1
  21. data/db/migrate/20141013172051_create_scaptimony_policies.rb +1 -1
  22. data/db/migrate/20141014105333_create_scaptimony_assets.rb +1 -1
  23. data/db/migrate/20141015092642_create_scaptimony_arf_reports.rb +1 -1
  24. data/db/migrate/20141015115511_add_arf_report_unique_constraint.rb +1 -1
  25. data/db/migrate/20141104164201_create_scaptimony_scap_contents.rb +1 -1
  26. data/db/migrate/20141104171545_create_scaptimony_policy_revisions.rb +1 -1
  27. data/db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb +1 -1
  28. data/db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb +1 -1
  29. data/db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb +1 -1
  30. data/db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb +1 -1
  31. data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +1 -1
  32. data/db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb +1 -1
  33. data/db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb +1 -1
  34. data/db/migrate/20141118142954_add_constraint_to_scaptimony_policies.rb +1 -1
  35. data/db/migrate/20141119164918_create_scaptimony_xccdf_results.rb +1 -1
  36. data/db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb +1 -1
  37. data/db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb +1 -1
  38. data/db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb +1 -1
  39. data/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb +1 -1
  40. data/db/migrate/20141206211151_create_scaptimony_assets_policies.rb +1 -1
  41. data/db/migrate/20141214112917_add_scap_file_to_scap_content.rb +1 -1
  42. data/db/migrate/20141216154502_rename_scaptimony_asset_policies.rb +1 -1
  43. data/db/migrate/20150111085317_polymorph_asset.rb +1 -1
  44. data/db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb +1 -1
  45. data/db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb +1 -1
  46. data/db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb +1 -1
  47. data/db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb +1 -1
  48. data/db/migrate/20150821100137_migrate_from_scaptimony.rb +1 -1
  49. data/db/migrate/20150827123826_remove_scaptimony_permissions.rb +1 -1
  50. data/db/migrate/20150925124959_create_policy_arf_reports.rb +1 -1
  51. data/db/migrate/20150929124853_add_result_to_logs.rb +1 -1
  52. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +2 -2
  53. data/db/migrate/20151118165125_add_size_to_scap_content.rb +1 -1
  54. data/db/migrate/20151119155419_add_arf_fields_to_message.rb +1 -1
  55. data/db/migrate/20151120090851_add_openscap_proxy_to_host_and_hostgroup.rb +1 -1
  56. data/db/migrate/20160830113437_remove_deleted_policy.rb +1 -1
  57. data/db/migrate/20160925213031_change_scap_widget_names.rb +1 -1
  58. data/db/migrate/20161109155255_create_tailoring_files.rb +1 -1
  59. data/db/migrate/20161223153249_add_permissions_to_arf_report.rb +1 -1
  60. data/db/migrate/20170821081205_rename_mail_notification.foreman_openscap.rb +1 -1
  61. data/db/migrate/20170830221751_add_index_to_logs_result.rb +1 -1
  62. data/db/migrate/20171011134112_remove_arf_reports_without_policy.rb +1 -11
  63. data/db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb +1 -1
  64. data/lib/foreman_openscap/engine.rb +5 -5
  65. data/lib/foreman_openscap/version.rb +1 -1
  66. data/test/factories/arf_report_factory.rb +1 -1
  67. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +21 -21
  68. data/test/functional/api/v2/compliance/policies_controller_test.rb +12 -12
  69. data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +6 -6
  70. data/test/functional/api/v2/compliance/tailoring_files_controller_test.rb +8 -8
  71. data/test/functional/arf_reports_controller_test.rb +3 -3
  72. data/test/functional/openscap_proxies_controller_test.rb +1 -1
  73. data/test/functional/tailoring_files_controller_test.rb +6 -6
  74. metadata +2 -2
@@ -3,7 +3,7 @@ require 'test_plugin_helper'
3
3
  class Api::V2::Compliance::ScapContentsControllerTest < ActionController::TestCase
4
4
  test "should get index" do
5
5
  FactoryBot.create(:scap_content)
6
- get :index, {}, set_session_user
6
+ get :index, :session => set_session_user
7
7
  response = ActiveSupport::JSON.decode(@response.body)
8
8
  assert response['results'].any?
9
9
  assert_response :success
@@ -11,13 +11,13 @@ class Api::V2::Compliance::ScapContentsControllerTest < ActionController::TestCa
11
11
 
12
12
  test "should return xml of scap content" do
13
13
  scap_content = FactoryBot.create(:scap_content)
14
- get :show, { :id => scap_content.id }, set_session_user
14
+ get :show, :params => { :id => scap_content.id }, :session => set_session_user
15
15
  assert(@response.header['Content-Type'], 'application/xml')
16
16
  assert_response :success
17
17
  end
18
18
 
19
19
  test "should not create invalid scap content" do
20
- post :create, {}, set_session_user
20
+ post :create, :session => set_session_user
21
21
  assert_response :unprocessable_entity
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ class Api::V2::Compliance::ScapContentsControllerTest < ActionController::TestCa
27
27
 
28
28
  test "should update scap content" do
29
29
  scap_content = FactoryBot.create(:scap_content)
30
- put :update, { :id => scap_content.id, :scap_content => { :title => 'RHEL7 SCAP' } }, set_session_user
30
+ put :update, :params => { :id => scap_content.id, :scap_content => { :title => 'RHEL7 SCAP' } }, :session => set_session_user
31
31
  assert_response :success
32
32
  assert scap_content.title, 'RHEL7 SCAP'
33
33
  end
@@ -36,13 +36,13 @@ class Api::V2::Compliance::ScapContentsControllerTest < ActionController::TestCa
36
36
  skip("Solve 'ActiveRecord::RecordInvalid' error")
37
37
  ProxyAPI::Openscap.any_instance.stubs(:validate_scap_content).returns({ 'errors' => ['Invalid file'] })
38
38
  scap_content = FactoryBot.create(:scap_content)
39
- put :update, { :id => scap_content.id, :scap_content => { :scap_file => '<xml>blah</xml>' } }, set_session_user
39
+ put :update, :params => { :id => scap_content.id, :scap_content => { :scap_file => '<xml>blah</xml>' } }, :session => set_session_user
40
40
  assert_response :unprocessable_entity
41
41
  end
42
42
 
43
43
  test "should destory scap content" do
44
44
  scap_content = FactoryBot.create(:scap_content)
45
- delete :destroy, { :id => scap_content.id }, set_session_user
45
+ delete :destroy, :params => { :id => scap_content.id }, :session => set_session_user
46
46
  assert_response :ok
47
47
  refute ForemanOpenscap::ScapContent.exists?(scap_content.id)
48
48
  end
@@ -3,7 +3,7 @@ require 'test_plugin_helper'
3
3
  class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::TestCase
4
4
  test "should get index" do
5
5
  FactoryBot.create(:tailoring_file)
6
- get :index, {}, set_session_user
6
+ get :index, :session => set_session_user
7
7
  response = ActiveSupport::JSON.decode(@response.body)
8
8
  assert response['results'].any?
9
9
  assert_response :success
@@ -11,13 +11,13 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
11
11
 
12
12
  test "should return xml of tailoring_file" do
13
13
  tailoring_file = FactoryBot.create(:tailoring_file)
14
- get :show, { :id => tailoring_file.id }, set_session_user
14
+ get :show, :params => { :id => tailoring_file.id }, :session => set_session_user
15
15
  assert(@response.header['Content-Type'], 'application/xml')
16
16
  assert_response :success
17
17
  end
18
18
 
19
19
  test "should not create invalid tailoring_file" do
20
- post :create, {}, set_session_user
20
+ post :create, :session => set_session_user
21
21
  assert_response :unprocessable_entity
22
22
  end
23
23
 
@@ -26,13 +26,13 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
26
26
  tf_params = { :name => tf.name, :original_filename => tf.original_filename, :scap_file => tf.scap_file }
27
27
  ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
28
28
  .returns({})
29
- post :create, tf_params, set_session_user
29
+ post :create, :params => tf_params, :session => set_session_user
30
30
  assert_response :success
31
31
  end
32
32
 
33
33
  test "should update tailoring_file" do
34
34
  tailoring_file = FactoryBot.create(:tailoring_file)
35
- put :update, { :id => tailoring_file.id, :tailoring_file => { :name => 'RHEL7 SCAP' } }, set_session_user
35
+ put :update, :params => { :id => tailoring_file.id, :tailoring_file => { :name => 'RHEL7 SCAP' } }, :session => set_session_user
36
36
  assert_response :success
37
37
  assert tailoring_file.name, 'RHEL7 SCAP'
38
38
  end
@@ -40,13 +40,13 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
40
40
  test "should not update invalid tailoring_file" do
41
41
  tailoring_file = FactoryBot.create(:tailoring_file)
42
42
  ProxyAPI::Openscap.any_instance.stubs(:validate_scap_file).returns({ 'errors' => ['Invalid file'] })
43
- put :update, { :id => tailoring_file.id, :tailoring_file => { :scap_file => '<xml>blah</xml>' } }, set_session_user
43
+ put :update, :params => { :id => tailoring_file.id, :tailoring_file => { :scap_file => '<xml>blah</xml>' } }, :session => set_session_user
44
44
  assert_response :unprocessable_entity
45
45
  end
46
46
 
47
47
  test "should destory tailoring_file" do
48
48
  tailoring_file = FactoryBot.create(:tailoring_file)
49
- delete :destroy, { :id => tailoring_file.id }, set_session_user
49
+ delete :destroy, :params => { :id => tailoring_file.id }, :session => set_session_user
50
50
  assert_response :ok
51
51
  refute ForemanOpenscap::ScapContent.exists?(tailoring_file.id)
52
52
  end
@@ -56,7 +56,7 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
56
56
  tf_params = { :name => tf.name, :original_filename => tf.original_filename, :scap_file => tf.scap_file }
57
57
  ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
58
58
  .returns('test-proxy' => '0.5.4')
59
- post :create, tf_params, set_session_user
59
+ post :create, :params => tf_params, :session => set_session_user
60
60
  assert_response :unprocessable_entity
61
61
  end
62
62
  end
@@ -11,7 +11,7 @@ class ArfReportsControllerTest < ActionController::TestCase
11
11
  ForemanOpenscap::ArfReport.any_instance.stubs(:openscap_proxy).returns(@host.openscap_proxy)
12
12
  arf_report = FactoryBot.create(:arf_report, :host_id => @host.id)
13
13
  assert_difference("ForemanOpenscap::ArfReport.count", -1) do
14
- delete :destroy, { :id => arf_report.id }, set_session_user
14
+ delete :destroy, :params => { :id => arf_report.id }, :session => set_session_user
15
15
  end
16
16
  assert_redirected_to arf_reports_path
17
17
  end
@@ -24,7 +24,7 @@ class ArfReportsControllerTest < ActionController::TestCase
24
24
  end
25
25
  last_arf = arf_reports[-1]
26
26
  assert_difference("ForemanOpenscap::ArfReport.unscoped.count", -2) do
27
- post :submit_delete_multiple, { :arf_report_ids => arf_reports[0..-2].map(&:id) }, set_session_user
27
+ post :submit_delete_multiple, :params => { :arf_report_ids => arf_reports[0..-2].map(&:id) }, :session => set_session_user
28
28
  end
29
29
  assert_redirected_to arf_reports_path
30
30
  assert_equal last_arf, ForemanOpenscap::ArfReport.unscoped.first
@@ -34,7 +34,7 @@ class ArfReportsControllerTest < ActionController::TestCase
34
34
  arf_report = FactoryBot.create(:arf_report, :host_id => @host.id)
35
35
  report_html = File.read("#{ForemanOpenscap::Engine.root}/test/files/arf_report/arf_report.html")
36
36
  ForemanOpenscap::ArfReport.any_instance.stubs(:to_html).returns(report_html)
37
- get :download_html, { :id => arf_report.id }, set_session_user
37
+ get :download_html, :params => { :id => arf_report.id }, :session => set_session_user
38
38
  assert_equal report_html, @response.body
39
39
  end
40
40
  end
@@ -9,7 +9,7 @@ class OpenscapProxiesControllerTest < ActionController::TestCase
9
9
  spool_error = { "timestamp" => 1_487_144_633.951_368, "level" => "ERROR", "message" => "Failed to parse Arf Report in test" }
10
10
  OpenscapProxiesController.any_instance.stubs(:find_spool_error).returns(spool_error)
11
11
  proxy = FactoryBot.create(:openscap_proxy)
12
- get :openscap_spool, { :id => proxy.id }, set_session_user
12
+ get :openscap_spool, :params => { :id => proxy.id }, :session => set_session_user
13
13
  assert_template :partial => 'smart_proxies/_openscap_spool'
14
14
  assert @response.body.match(date_time_relative_value(Time.at(spool_error["timestamp"])))
15
15
  end
@@ -7,30 +7,30 @@ class TailoringFilesControllerTest < ActionController::TestCase
7
7
  end
8
8
 
9
9
  test 'index' do
10
- get :index, {}, set_session_user
10
+ get :index, :session => set_session_user
11
11
  assert_template 'index'
12
12
  end
13
13
 
14
14
  test 'new' do
15
- get :new, {}, set_session_user
15
+ get :new, :session => set_session_user
16
16
  assert_template 'new'
17
17
  end
18
18
 
19
19
  test 'edit' do
20
- get :edit, { :id => @tailoring_file.id }, set_session_user
20
+ get :edit, :params => { :id => @tailoring_file.id }, :session => set_session_user
21
21
  assert_template 'edit'
22
22
  end
23
23
 
24
24
  test 'create' do
25
- uploaded_file = Rack::Test::UploadedFile.new(@scap_file, 'text/xml')
25
+ uploaded_file = Rack::Test::UploadedFile.new(@scap_file, 'text/xml', :original_filename => 'uploaded_tailoring.file')
26
26
  # uploaded_file.original_filename = 'uploaded-tailoring-file.xml'
27
- post :create, { :tailoring_file => { :name => 'some_file', :scap_file => uploaded_file } }, set_session_user
27
+ post :create, :params => { :tailoring_file => { :name => 'some_file', :scap_file => uploaded_file } }, :session => set_session_user
28
28
  assert_redirected_to tailoring_files_url
29
29
  end
30
30
 
31
31
  test 'destroy' do
32
32
  tf = ForemanOpenscap::TailoringFile.first
33
- delete :destroy, { :id => tf.id }, set_session_user
33
+ delete :destroy, :params => { :id => tf.id }, :session => set_session_user
34
34
  assert_redirected_to tailoring_files_url
35
35
  refute ForemanOpenscap::TailoringFile.exists?(tf.id)
36
36
  end
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.6
4
+ version: 0.9.0
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: 2018-03-13 00:00:00.000000000 Z
11
+ date: 2018-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface