foreman_openscap 5.2.1 → 5.2.2

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: 92bab404c3bb495719fa2ecf62c84cdcea0cf42a4fe9cdc7f07fc6a99341a803
4
- data.tar.gz: 36cd15417a6f421c8424b4f24cfa21e1ec09f59d297955db6a0a8f97e90c6adf
3
+ metadata.gz: 91721fce685ae564d178a80978c2196d57dd6320d97a8fdd0ae1a98bafa41a90
4
+ data.tar.gz: 62f620936950eb8964353071eb16afb329245f63389f5e78d210420c832b86bd
5
5
  SHA512:
6
- metadata.gz: d4713c26ae5f19cf96cf2ae88900a078457646e57a1fce213f1d63b430a1468d89d0a6ae0ae29cced95456c643a0c469f46c2eafeb5c9fe2f870f7c589b44ade
7
- data.tar.gz: ebbfd812e483cd88aa6dc279f17734eac782c97a3c8696be7879a41961fe6e79ee3b7f6342726faa6220a275ea48b3edf8292bc14424a8f87f01968749cf3c72
6
+ metadata.gz: 4c11e0c0aad9eacae1765d6f39e94cf5f1559a2719b54520847a50ae324591807db1a1ba20d394828c2c8167322029758f582591e9ecbad0438df7eea141b834
7
+ data.tar.gz: 47fca0728c35aa94bd3b9c21195838219a9f119df5bd1df4ab4b116d55ac4c5f1e2132b2353a0c8ce75f2075f07205f32a443bc12405cee5f1d13478d6b90a52
@@ -16,7 +16,7 @@ module ForemanOpenscap
16
16
  end
17
17
 
18
18
  def available?
19
- defined?(ForemanAnsible)
19
+ Foreman::Plugin.installed?("foreman_ansible")
20
20
  end
21
21
 
22
22
  def inline_help
@@ -10,7 +10,7 @@ module ForemanOpenscap
10
10
  end
11
11
 
12
12
  def available?
13
- defined?(ForemanPuppet)
13
+ Foreman::Plugin.installed?("foreman_puppet")
14
14
  end
15
15
 
16
16
  def inline_help
@@ -10,7 +10,7 @@ class MigratePortOverridesToInt < ActiveRecord::Migration[5.2]
10
10
  private
11
11
 
12
12
  def transform_lookup_values(method)
13
- return unless defined?(ForemanPuppet)
13
+ return unless Foreman::Plugin.installed?("foreman_puppet")
14
14
  puppet_class = ::ForemanPuppet::Puppetclass.find_by :name => 'foreman_scap_client'
15
15
  return unless puppet_class
16
16
  port_key = puppet_class.class_params.find_by :key => 'port'
@@ -10,7 +10,7 @@ class MigratePortOverridesForAnsible < ActiveRecord::Migration[6.0]
10
10
  private
11
11
 
12
12
  def transform_lookup_values(method)
13
- return unless defined?(ForemanAnsible)
13
+ return unless Foreman::Plugin.installed?("foreman_ansible")
14
14
  role = AnsibleRole.find_by :name => 'theforeman.foreman_scap_client'
15
15
  return unless role
16
16
  port_key = role.ansible_variables.find_by :key => 'foreman_scap_client_port'
@@ -10,7 +10,7 @@ class UpdatePuppetPortParamType < ActiveRecord::Migration[6.0]
10
10
  private
11
11
 
12
12
  def update_port_type(method)
13
- return unless defined?(ForemanPuppet)
13
+ return unless Foreman::Plugin.installed?("foreman_puppet")
14
14
  puppet_class = ::ForemanPuppet::Puppetclass.find_by :name => 'foreman_scap_client'
15
15
  return unless puppet_class
16
16
  port_key = puppet_class.class_params.find_by :key => 'port'
@@ -1,6 +1,6 @@
1
1
  module ForemanOpenscap
2
2
  def self.with_katello?
3
- defined?(::Katello)
3
+ Foreman::Plugin.installed?("katello")
4
4
  end
5
5
 
6
6
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "5.2.1".freeze
2
+ VERSION = "5.2.2".freeze
3
3
  end
@@ -5,14 +5,14 @@ require 'test_helper'
5
5
  FactoryBot.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
6
6
  # Add factories from foreman_ansible
7
7
  FactoryBot.definition_file_paths << File.join(ForemanAnsible::Engine.root, '/test/factories')
8
- FactoryBot.definition_file_paths << File.join(ForemanPuppet::Engine.root, '/test/factories') if defined?(ForemanPuppet)
8
+ FactoryBot.definition_file_paths << File.join(ForemanPuppet::Engine.root, '/test/factories') if defined?(ForemanPuppet::Engine)
9
9
  FactoryBot.reload
10
10
 
11
11
  require "#{ForemanOpenscap::Engine.root}/test/fixtures/cve_fixtures"
12
12
 
13
13
  module ScapClientPuppetclass
14
14
  def puppet_available?
15
- defined?(ForemanPuppet)
15
+ Foreman::Plugin.installed?("foreman_puppet")
16
16
  end
17
17
 
18
18
  def setup_puppet_class
@@ -1,8 +1,5 @@
1
1
  import { addSearch } from '../../helpers/pageParamsHelper';
2
2
 
3
- export const preparePerPageOptions = opts =>
4
- opts.map(item => ({ title: item.toString(), value: item }));
5
-
6
3
  export const refreshPage = (history, params = {}) => {
7
4
  const url = addSearch(history.location.pathname, params);
8
5
  history.push(url);
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Table, TableHeader, TableBody } from '@patternfly/react-table';
4
- import { Pagination, Flex, FlexItem } from '@patternfly/react-core';
5
- import { usePaginationOptions } from 'foremanReact/components/Pagination/PaginationHooks';
6
-
7
- import { preparePerPageOptions, refreshPage } from './IndexTableHelper';
4
+ import { Flex, FlexItem } from '@patternfly/react-core';
5
+ import Pagination from 'foremanReact/components/Pagination';
6
+ import { refreshPage } from './IndexTableHelper';
8
7
 
9
8
  const IndexTable = ({
10
9
  history,
@@ -15,16 +14,14 @@ const IndexTable = ({
15
14
  columns,
16
15
  ...rest
17
16
  }) => {
18
- const handlePerPageSelected = (event, perPage) => {
17
+ const handlePerPageSelected = perPage => {
19
18
  refreshPage(history, { page: 1, perPage });
20
19
  };
21
20
 
22
- const handlePageSelected = (event, page) => {
21
+ const handlePageSelected = page => {
23
22
  refreshPage(history, { ...pagination, page });
24
23
  };
25
24
 
26
- const perPageOptions = preparePerPageOptions(usePaginationOptions());
27
-
28
25
  return (
29
26
  <React.Fragment>
30
27
  <Flex className="pf-u-pt-md">
@@ -36,7 +33,6 @@ const IndexTable = ({
36
33
  perPage={pagination.perPage}
37
34
  onSetPage={handlePageSelected}
38
35
  onPerPageSelect={handlePerPageSelected}
39
- perPageOptions={perPageOptions}
40
36
  variant="top"
41
37
  />
42
38
  </FlexItem>
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  import { render, screen, waitFor } from '@testing-library/react';
3
- import { within } from '@testing-library/dom';
4
- import userEvent from '@testing-library/user-event';
5
3
  import '@testing-library/jest-dom';
6
4
 
7
5
  import OvalContentsIndex from '../';
@@ -13,13 +11,9 @@ import {
13
11
  tick,
14
12
  historyMock,
15
13
  } from '../../../../testHelper';
16
- import { ovalContentsPath } from '../../../../helpers/pathsHelper';
17
14
 
18
15
  import {
19
16
  mocks,
20
- paginatedMocks,
21
- pushMock,
22
- pagePaginationHistoryMock,
23
17
  emptyMocks,
24
18
  errorMocks,
25
19
  viewerMocks,
@@ -32,9 +26,7 @@ const TestComponent = withRedux(
32
26
 
33
27
  describe('OvalContentsIndex', () => {
34
28
  it('should load page', async () => {
35
- const { container } = render(
36
- <TestComponent history={historyMock} mocks={mocks} location={{}} />
37
- );
29
+ render(<TestComponent history={historyMock} mocks={mocks} location={{}} />);
38
30
  expect(screen.getByText('Loading')).toBeInTheDocument();
39
31
  await waitFor(tick);
40
32
  expect(screen.queryByText('Loading')).not.toBeInTheDocument();
@@ -46,31 +38,6 @@ describe('OvalContentsIndex', () => {
46
38
  ).toBeInTheDocument();
47
39
  expect(screen.getByText('openshift OVAL content')).toBeInTheDocument();
48
40
  expect(screen.getByText('openshift.oval.xml.bz2')).toBeInTheDocument();
49
- const pageItems = container.querySelector('.pf-c-pagination__total-items');
50
- expect(within(pageItems).getByText(/1 - 4/)).toBeInTheDocument();
51
- expect(within(pageItems).getByText('of')).toBeInTheDocument();
52
- expect(within(pageItems).getByText('4')).toBeInTheDocument();
53
- });
54
- it('should load page with pagination params', async () => {
55
- const { container } = render(
56
- <TestComponent
57
- history={pagePaginationHistoryMock}
58
- location={{}}
59
- mocks={paginatedMocks}
60
- />
61
- );
62
- await waitFor(tick);
63
- const pageItems = container.querySelector('.pf-c-pagination__total-items');
64
- expect(within(pageItems).getByText(/6 - 7/)).toBeInTheDocument();
65
- expect(within(pageItems).getByText('of')).toBeInTheDocument();
66
- expect(within(pageItems).getByText('7')).toBeInTheDocument();
67
- userEvent.click(
68
- screen.getByRole('button', { name: 'Go to previous page' })
69
- );
70
-
71
- expect(pushMock).toHaveBeenCalledWith(
72
- `${ovalContentsPath}?page=1&perPage=5`
73
- );
74
41
  });
75
42
  it('should show empty state', async () => {
76
43
  render(
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  import { render, screen, waitFor } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import { within } from '@testing-library/dom';
5
3
  import '@testing-library/jest-dom';
6
4
 
7
5
  import {
@@ -14,9 +12,6 @@ import {
14
12
 
15
13
  import {
16
14
  mocks,
17
- pushMock,
18
- pageParamsMocks,
19
- pageParamsHistoryMock,
20
15
  emptyMocks,
21
16
  errorMocks,
22
17
  viewerMocks,
@@ -24,7 +19,6 @@ import {
24
19
  } from './OvalPoliciesIndex.fixtures';
25
20
 
26
21
  import OvalPoliciesIndex from '../index';
27
- import { ovalPoliciesPath } from '../../../../helpers/pathsHelper';
28
22
 
29
23
  const TestComponent = withRouter(
30
24
  withRedux(withMockedProvider(OvalPoliciesIndex))
@@ -32,19 +26,13 @@ const TestComponent = withRouter(
32
26
 
33
27
  describe('OvalPoliciesIndex', () => {
34
28
  it('should load page', async () => {
35
- const { container } = render(
36
- <TestComponent history={historyMock} mocks={mocks} />
37
- );
29
+ render(<TestComponent history={historyMock} mocks={mocks} />);
38
30
  expect(screen.getByText('Loading')).toBeInTheDocument();
39
31
  await waitFor(tick);
40
32
  expect(screen.getByText('first policy')).toBeInTheDocument();
41
33
  expect(screen.getByText('second policy')).toBeInTheDocument();
42
34
  expect(screen.getByText('first content')).toBeInTheDocument();
43
35
  expect(screen.getByText('second content')).toBeInTheDocument();
44
- const pageItems = container.querySelector('.pf-c-pagination__total-items');
45
- expect(within(pageItems).getByText(/1 - 2/)).toBeInTheDocument();
46
- expect(within(pageItems).getByText('of')).toBeInTheDocument();
47
- expect(within(pageItems).getByText('2')).toBeInTheDocument();
48
36
 
49
37
  expect(screen.getByText('first policy').closest('a')).toHaveAttribute(
50
38
  'href',
@@ -55,23 +43,6 @@ describe('OvalPoliciesIndex', () => {
55
43
  '/experimental/compliance/oval_policies/40'
56
44
  );
57
45
  });
58
- it('should load page with page params', async () => {
59
- const { container } = render(
60
- <TestComponent history={pageParamsHistoryMock} mocks={pageParamsMocks} />
61
- );
62
- await waitFor(tick);
63
- const pageItems = container.querySelector('.pf-c-pagination__total-items');
64
- expect(within(pageItems).getByText(/6 - 7/)).toBeInTheDocument();
65
- expect(within(pageItems).getByText('of')).toBeInTheDocument();
66
- expect(within(pageItems).getByText('7')).toBeInTheDocument();
67
- userEvent.click(
68
- screen.getByRole('button', { name: 'Go to previous page' })
69
- );
70
-
71
- expect(pushMock).toHaveBeenCalledWith(
72
- `${ovalPoliciesPath}?page=1&perPage=5`
73
- );
74
- });
75
46
  it('should show empty state', async () => {
76
47
  render(<TestComponent history={historyMock} mocks={emptyMocks} />);
77
48
  expect(screen.getByText('Loading')).toBeInTheDocument();
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: 5.2.1
4
+ version: 5.2.2
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: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -521,64 +521,64 @@ signing_key:
521
521
  specification_version: 4
522
522
  summary: Foreman plug-in for displaying OpenSCAP audit reports
523
523
  test_files:
524
+ - test/factories/arf_report_factory.rb
524
525
  - test/factories/asset_factory.rb
525
- - test/factories/policy_arf_report_factory.rb
526
- - test/factories/policy_factory.rb
527
- - test/factories/scap_content_related.rb
528
526
  - test/factories/compliance_host_factory.rb
527
+ - test/factories/compliance_log_factory.rb
529
528
  - test/factories/oval_content_factory.rb
530
529
  - test/factories/oval_policy_factory.rb
531
- - test/factories/arf_report_factory.rb
532
- - test/factories/compliance_log_factory.rb
530
+ - test/factories/policy_arf_report_factory.rb
531
+ - test/factories/policy_factory.rb
532
+ - test/factories/scap_content_related.rb
533
533
  - test/files/arf_report/arf_report.bz2
534
534
  - test/files/arf_report/arf_report.html
535
535
  - test/files/arf_report/arf_report.json
536
536
  - test/files/arf_report/arf_report_msg_desc_changed.json
537
537
  - test/files/arf_report/arf_report_msg_value_changed.json
538
+ - test/files/oval_contents/ansible-2.9.oval.xml.bz2
538
539
  - test/files/scap_contents/ssg-fedora-ds.xml
539
540
  - test/files/tailoring_files/ssg-firefox-ds-tailoring-2.xml
540
541
  - test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
541
- - test/files/oval_contents/ansible-2.9.oval.xml.bz2
542
- - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
543
- - test/functional/api/v2/compliance/scap_contents_controller_test.rb
544
- - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
542
+ - test/fixtures/cve_fixtures.rb
543
+ - test/functional/api/v2/compliance/arf_reports_controller_test.rb
545
544
  - test/functional/api/v2/compliance/oval_contents_controller_test.rb
546
545
  - test/functional/api/v2/compliance/oval_policies_controller_test.rb
547
- - test/functional/api/v2/compliance/arf_reports_controller_test.rb
548
546
  - test/functional/api/v2/compliance/oval_reports_controller_test.rb
549
547
  - test/functional/api/v2/compliance/policies_controller_test.rb
548
+ - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
549
+ - test/functional/api/v2/compliance/scap_contents_controller_test.rb
550
+ - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
550
551
  - test/functional/api/v2/hosts_controller_test.rb
551
552
  - test/functional/arf_reports_controller_test.rb
552
553
  - test/functional/openscap_proxies_controller_test.rb
553
554
  - test/functional/tailoring_files_controller_test.rb
555
+ - test/graphql/mutations/oval_policies/delete_mutation_test.rb
556
+ - test/graphql/queries/oval_content_query_test.rb
557
+ - test/graphql/queries/oval_contents_query_test.rb
558
+ - test/graphql/queries/oval_policies_query_test.rb
554
559
  - test/helpers/arf_report_dashboard_helper_test.rb
555
560
  - test/helpers/policy_dashboard_helper_test.rb
556
561
  - test/lib/foreman_openscap/bulk_upload_test.rb
557
- - test/unit/concerns/host_extensions_test.rb
558
- - test/unit/concerns/openscap_proxy_extenstions_test.rb
559
- - test/unit/services/tailoring_files_proxy_check_test.rb
560
- - test/unit/services/oval/setup_test.rb
561
- - test/unit/services/oval/cves_test.rb
562
- - test/unit/services/oval/setup_check_test.rb
563
- - test/unit/services/config_name_service_test.rb
564
- - test/unit/services/lookup_key_overrider_test.rb
565
- - test/unit/services/report_dashboard/data_test.rb
566
- - test/unit/services/hostgroup_overrider_test.rb
562
+ - test/test_plugin_helper.rb
567
563
  - test/unit/arf_report_status_calculator_test.rb
564
+ - test/unit/arf_report_test.rb
568
565
  - test/unit/compliance_status_test.rb
569
- - test/unit/policy_mailer_test.rb
570
- - test/unit/scap_content_test.rb
571
- - test/unit/tailoring_file_test.rb
566
+ - test/unit/concerns/host_extensions_test.rb
567
+ - test/unit/concerns/openscap_proxy_extenstions_test.rb
568
+ - test/unit/message_cleaner_test.rb
569
+ - test/unit/openscap_host_test.rb
572
570
  - test/unit/oval_host_test.rb
573
571
  - test/unit/oval_policy_test.rb
574
572
  - test/unit/oval_status_test.rb
573
+ - test/unit/policy_mailer_test.rb
575
574
  - test/unit/policy_test.rb
576
- - test/unit/arf_report_test.rb
577
- - test/unit/message_cleaner_test.rb
578
- - test/unit/openscap_host_test.rb
579
- - test/fixtures/cve_fixtures.rb
580
- - test/graphql/queries/oval_contents_query_test.rb
581
- - test/graphql/queries/oval_policies_query_test.rb
582
- - test/graphql/queries/oval_content_query_test.rb
583
- - test/graphql/mutations/oval_policies/delete_mutation_test.rb
584
- - test/test_plugin_helper.rb
575
+ - test/unit/scap_content_test.rb
576
+ - test/unit/services/config_name_service_test.rb
577
+ - test/unit/services/hostgroup_overrider_test.rb
578
+ - test/unit/services/lookup_key_overrider_test.rb
579
+ - test/unit/services/oval/cves_test.rb
580
+ - test/unit/services/oval/setup_check_test.rb
581
+ - test/unit/services/oval/setup_test.rb
582
+ - test/unit/services/report_dashboard/data_test.rb
583
+ - test/unit/services/tailoring_files_proxy_check_test.rb
584
+ - test/unit/tailoring_file_test.rb