foreman_openscap 13.2.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c87d1f5b2553990c35d7307969efd773d1a29a29f7871f91aafca638789c746
4
- data.tar.gz: c9bebdf6c2008237cad80975e5c675e708b031f4167c1b75abcf28a1d77d7e21
3
+ metadata.gz: b12d4b48b8b1117cf1b3b99e1f1796fa9f5f799b366890411451656bba8c84d3
4
+ data.tar.gz: a31f8bd8d9b0f918d955ac02bbf0942d40f9a5c156fb4b2b214276fd8a81f62f
5
5
  SHA512:
6
- metadata.gz: bb4f58ffa8e0d4b7ee9142be81f4193fce8f72f130ebef4ff0d1fc2f54b980983b27835cbe020b1bc2ba11cf5e89d3e56bb2dcdfce50b567d46f5162c275733b
7
- data.tar.gz: 4773b95b988c447e2db42f6974b0dc893ce8fcb4350615f124698db83a203f26cdc428fcebd25591635b0841ad5d7441130548fd6f3b85457979e9f5d624dc27
6
+ metadata.gz: 71bc8b6700394cba3f7026c5eb9fea26a53c604be5271a4be8546c6efa7a114d629bab1e279adb81e22bf2638c7f8f432bbf0a345813cc5aece37cd511df0e36
7
+ data.tar.gz: 37ab24e756251309f375496ab45072eab3bbca0bde871263223fe6030c800efe4449fb61d2641b04b5b362d42db2ea7db9efeb293976a4defbd4e6d9d301001e
data/README.md CHANGED
@@ -122,6 +122,15 @@ Make sure that
122
122
  ```
123
123
  - start your Rails server, verify openscap plugin is present
124
124
 
125
+ ### JavaScript testing and linting
126
+
127
+ Run the plugin's JavaScript checks from the Foreman core checkout, which provides the shared test and lint tools:
128
+
129
+ ```sh
130
+ npm run test:plugins foreman_openscap
131
+ npm run lint:plugins foreman_openscap
132
+ ```
133
+
125
134
  ## Releasing
126
135
 
127
136
  follow these steps:
@@ -116,7 +116,7 @@ module ForemanOpenscap
116
116
  def scap_status_changed?(policy)
117
117
  last_reports = reports_for_policy(policy, 2)
118
118
  return false if last_reports.length != 2
119
- !last_reports.first.equal? last_reports.last
119
+ !last_reports.first.same_content?(last_reports.last)
120
120
  end
121
121
 
122
122
  def last_report_for_policy(policy)
@@ -186,7 +186,8 @@ module ForemanOpenscap
186
186
  openscap_proxy_api.arf_report_bzip(self, ForemanOpenscap::Helper::find_name_or_uuid_by_host(host))
187
187
  end
188
188
 
189
- def equal?(other)
189
+ def same_content?(other)
190
+ return false unless other
190
191
  results = [logs, other.logs].flatten.group_by(&:source_id).values
191
192
  # for each rule, there should be one result from both reports
192
193
  return false unless results.map(&:length).all? { |item| item == 2 }
@@ -40,7 +40,7 @@ module ForemanOpenscap
40
40
  initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app|
41
41
  app.reloader.to_prepare do
42
42
  Foreman::Plugin.register :foreman_openscap do
43
- requires_foreman '>= 5.0'
43
+ requires_foreman '>= 5.1'
44
44
  register_gettext
45
45
 
46
46
  apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = '13.2.0'.freeze
2
+ VERSION = '14.0.0'.freeze
3
3
  end
data/package.json CHANGED
@@ -3,42 +3,11 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Foreman plug-in for managing security compliance reports",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "lint": "tfm-lint --plugin -d /webpack",
8
- "lint:custom": "eslint ./webpack",
9
- "test": "tfm-test --plugin --config jest.config.js",
10
- "test:watch": "tfm-test --plugin --watchAll --config jest.config.js",
11
- "test:current": "tfm-test --plugin --watch --config jest.config.js",
12
- "publish-coverage": "tfm-publish-coverage",
13
- "create-react-component": "yo react-domain"
14
- },
15
6
  "repository": {
16
7
  "type": "git",
17
8
  "url": "git+https://github.com/theforeman/foreman_openscap.git"
18
9
  },
19
10
  "bugs": {
20
11
  "url": "https://projects.theforeman.org/projects/foreman_openscap/issues"
21
- },
22
- "peerDependencies": {
23
- "@theforeman/vendor": ">= 10.1.0"
24
- },
25
- "devDependencies": {
26
- "@babel/core": "^7.7.0",
27
- "@testing-library/dom": "^8.9.1",
28
- "@testing-library/jest-dom": "^5.11.9",
29
- "@testing-library/user-event": "^13.2.1",
30
- "@theforeman/builder": ">= 10.1.0",
31
- "@theforeman/eslint-plugin-foreman": ">= 10.1.0",
32
- "@theforeman/eslint-plugin-rules": ">= 10.1.0",
33
- "@theforeman/find-foreman": ">= 10.1.0",
34
- "@theforeman/test": ">= 10.1.0",
35
- "@theforeman/vendor-dev": ">= 10.1.0",
36
- "babel-eslint": "^10.0.3",
37
- "eslint": "^6.7.2",
38
- "jed": "^1.1.1",
39
- "jest-svg-transformer": "^1.0.0",
40
- "prettier": "^1.13.5",
41
- "stylelint": "^9.3.0",
42
- "stylelint-config-standard": "^18.0.0"
43
12
  }
44
13
  }
@@ -17,16 +17,16 @@ module ForemanOpenscap
17
17
  @status = { :passed => 5, :failed => 1, :othered => 7 }.with_indifferent_access
18
18
  end
19
19
 
20
- test 'equal? should return true when there is no change in report results' do
20
+ test 'same_content? should return true when there is no change in report results' do
21
21
  report_1 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
22
22
  report_2 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
23
23
  create_logs_for_report(report_1, [@passed_log_params, @failed_log_params])
24
24
  create_logs_for_report(report_2, [@passed_log_params, @failed_log_params])
25
25
 
26
- assert(report_1.equal?(report_2))
26
+ assert(report_1.same_content?(report_2))
27
27
  end
28
28
 
29
- test 'equal? should return false when there is change in report results' do
29
+ test 'same_content? should return false when there is change in report results' do
30
30
  new_source = FactoryBot.create(:source)
31
31
 
32
32
  report_1 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
@@ -34,36 +34,36 @@ module ForemanOpenscap
34
34
  create_logs_for_report(report_1, [@passed_log_params, @failed_log_params])
35
35
  create_logs_for_report(report_2, [@passed_log_params, @passed_log_params])
36
36
 
37
- refute(report_1.equal?(report_2))
37
+ refute(report_1.same_content?(report_2))
38
38
  end
39
39
 
40
- test 'equal? should return false when reports have different sets of rules' do
40
+ test 'same_content? should return false when reports have different sets of rules' do
41
41
  report_1 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
42
42
  report_2 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
43
43
  create_logs_for_report(report_1, [@passed_log_params, @failed_log_params])
44
44
  create_logs_for_report(report_2, [@passed_log_params])
45
45
 
46
- refute(report_1.equal?(report_2))
46
+ refute(report_1.same_content?(report_2))
47
47
  end
48
48
 
49
- test 'equal? should return false when reports have different hosts' do
49
+ test 'same_content? should return false when reports have different hosts' do
50
50
  host = FactoryBot.create(:compliance_host)
51
51
  report_1 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
52
52
  report_2 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => host.id)
53
53
  create_logs_for_report(report_1, [@passed_log_params, @failed_log_params])
54
54
  create_logs_for_report(report_2, [@passed_log_params, @failed_log_params])
55
55
 
56
- refute(report_1.equal?(report_2))
56
+ refute(report_1.same_content?(report_2))
57
57
  end
58
58
 
59
- test 'equal? should return false when reports have different policies' do
59
+ test 'same_content? should return false when reports have different policies' do
60
60
  policy = FactoryBot.create(:policy)
61
61
  report_1 = FactoryBot.create(:arf_report, :policy => @policy, :host_id => @host.id)
62
62
  report_2 = FactoryBot.create(:arf_report, :policy => policy, :host_id => @host.id)
63
63
  create_logs_for_report(report_1, [@passed_log_params, @failed_log_params])
64
64
  create_logs_for_report(report_2, [@passed_log_params, @failed_log_params])
65
65
 
66
- refute(report_1.equal?(report_2))
66
+ refute(report_1.same_content?(report_2))
67
67
  end
68
68
 
69
69
  test 'should recognize report that failed' do
@@ -63,12 +63,12 @@ class OpenscapHostTest < ActiveSupport::TestCase
63
63
  end
64
64
 
65
65
  test 'scap_status_changed should detect status change' do
66
- ForemanOpenscap::ArfReport.any_instance.stubs(:equal?).returns(false)
66
+ ForemanOpenscap::ArfReport.any_instance.stubs(:same_content?).returns(false)
67
67
  assert @host.scap_status_changed?(@policy)
68
68
  end
69
69
 
70
70
  test 'scap_status_changed should not detect status change when there is none' do
71
- ForemanOpenscap::ArfReport.any_instance.stubs(:equal?).returns(true)
71
+ ForemanOpenscap::ArfReport.any_instance.stubs(:same_content?).returns(true)
72
72
  refute @host.scap_status_changed?(@policy)
73
73
  end
74
74
 
@@ -44,8 +44,7 @@ const actionsBarValue = {
44
44
 
45
45
  const renderMenuItem = (props = {}) =>
46
46
  renderWithStore(
47
- // eslint-disable-next-line @theforeman/rules/require-ouiaid
48
- <Menu activeItemId={null}>
47
+ <Menu ouiaId="change-openscap-proxy-menu" activeItemId={null}>
49
48
  <MenuContent>
50
49
  <MenuList>
51
50
  <ChangeOpenscapProxyMenuItem selectedCount={3} {...props} />
@@ -73,8 +72,7 @@ const renderMenuItemWithScene = (
73
72
  <ForemanActionsBarContext.Provider
74
73
  value={{ ...actionsBarValue, ...contextValue }}
75
74
  >
76
- {/* eslint-disable-next-line @theforeman/rules/require-ouiaid */}
77
- <Menu activeItemId={null}>
75
+ <Menu ouiaId="change-openscap-proxy-menu-with-scene" activeItemId={null}>
78
76
  <MenuContent>
79
77
  <MenuList>
80
78
  <ChangeOpenscapProxyMenuItem selectedCount={3} {...menuProps} />
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.0
4
+ version: 14.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - slukasik@redhat.com