foreman_rh_cloud 13.2.11 → 14.0.1

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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
  7. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
  8. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +10 -13
  9. data/app/controllers/insights_cloud/ui_requests_controller.rb +7 -3
  10. data/app/models/concerns/rh_cloud_host.rb +4 -71
  11. data/app/models/insights_client_report_status.rb +1 -9
  12. data/app/models/inventory_sync/inventory_status.rb +4 -16
  13. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
  14. data/app/services/foreman_rh_cloud/url_remediations_retriever.rb +5 -19
  15. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
  16. data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +0 -2
  17. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +4 -34
  18. data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
  19. data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
  20. data/lib/foreman_inventory_upload.rb +1 -8
  21. data/lib/foreman_rh_cloud/engine.rb +0 -1
  22. data/lib/foreman_rh_cloud/version.rb +1 -1
  23. data/lib/foreman_rh_cloud.rb +9 -36
  24. data/lib/insights_cloud/async/insights_generate_notifications.rb +1 -10
  25. data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
  26. data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
  27. data/lib/inventory_sync/async/inventory_self_host_sync.rb +2 -12
  28. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  29. data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
  30. data/locale/fr/foreman_rh_cloud.po +65 -66
  31. data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
  32. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  33. data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
  34. data/locale/ja/foreman_rh_cloud.po +70 -72
  35. data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
  36. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  37. data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
  38. data/locale/ka/foreman_rh_cloud.po +10 -11
  39. data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
  40. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  41. data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
  42. data/locale/ko/foreman_rh_cloud.po +63 -64
  43. data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
  44. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  45. data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
  46. data/locale/zh_CN/foreman_rh_cloud.po +64 -65
  47. data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
  48. data/package.json +1 -1
  49. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +3 -57
  50. data/test/controllers/insights_cloud/ui_requests_controller_test.rb +2 -16
  51. data/test/jobs/insights_client_status_aging_test.rb +0 -40
  52. data/test/jobs/inventory_full_sync_test.rb +4 -219
  53. data/test/jobs/inventory_hosts_sync_test.rb +5 -7
  54. data/test/jobs/inventory_self_host_sync_test.rb +1 -10
  55. data/test/jobs/upload_report_direct_job_test.rb +0 -29
  56. data/test/models/insights_client_report_status_test.rb +0 -109
  57. data/test/unit/archived_report_generator_test.rb +1 -2
  58. data/test/unit/fact_helpers_test.rb +0 -16
  59. data/test/unit/foreman_rh_cloud_self_host_test.rb +2 -50
  60. data/test/unit/insights_facet_test.rb +0 -5
  61. data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
  62. data/test/unit/metadata_generator_test.rb +1 -24
  63. data/test/unit/rh_cloud_host_test.rb +0 -282
  64. data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
  65. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
  66. data/test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb +5 -82
  67. data/test/unit/slice_generator_test.rb +2 -21
  68. data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +3 -30
  69. data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +10 -112
  70. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js +9 -10
  71. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap +18 -0
  72. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +9 -13
  73. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +25 -0
  74. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +9 -20
  75. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap +20 -0
  76. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +8 -31
  77. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +47 -0
  78. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +10 -26
  79. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +59 -0
  80. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +9 -33
  81. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +34 -0
  82. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +14 -0
  83. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +35 -55
  84. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +25 -0
  85. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +49 -0
  86. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +86 -0
  87. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +75 -0
  88. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +46 -0
  89. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +9 -13
  90. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +26 -0
  91. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +15 -12
  92. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js +14 -0
  93. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +28 -0
  94. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js +21 -0
  95. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +21 -0
  96. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap +17 -0
  97. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +19 -0
  98. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap +9 -0
  99. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +43 -0
  100. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +12 -32
  101. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/AdvancedSettingActions.test.js +9 -0
  102. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/__snapshots__/AdvancedSettingActions.test.js.snap +18 -0
  103. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettingsActions.test.js +14 -0
  104. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettingsActions.test.js.snap +26 -0
  105. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageTitle.test.js +7 -15
  106. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +68 -0
  107. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
  108. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +18 -47
  109. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
  110. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +59 -0
  111. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
  112. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/SettingsWarning.test.js +15 -58
  113. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/__snapshots__/SettingsWarning.test.js.snap +32 -0
  114. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
  115. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +9 -23
  116. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +17 -19
  117. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +15 -0
  118. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +3 -0
  119. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +57 -0
  120. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +36 -25
  121. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
  122. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +8 -28
  123. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +23 -0
  124. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +8 -25
  125. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +74 -0
  126. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +9 -11
  127. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap +18 -0
  128. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +9 -11
  129. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap +12 -0
  130. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +1 -8
  131. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +12 -33
  132. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +96 -0
  133. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +8 -36
  134. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryUpload.test.js +10 -0
  135. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +5 -0
  136. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +14 -0
  137. data/webpack/ForemanRhCloudHelpers.js +0 -22
  138. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +15 -71
  139. metadata +57 -18
  140. data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
  141. data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
  142. data/test/jobs/insights_generate_notifications_test.rb +0 -26
  143. data/test/models/inventory_sync/inventory_status_test.rb +0 -85
  144. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
  145. data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -266
@@ -1,38 +1,18 @@
1
1
  import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import { Provider } from 'react-redux';
4
- import configureMockStore from 'redux-mock-store';
5
- import thunk from 'redux-thunk';
6
- import ConnectedInventoryFilter from '../index';
7
- import { INVENTORY_FILTER_UPDATE } from '../InventoryFilterConstants';
8
-
9
- jest.mock('foremanReact/Root/Context/ForemanContext');
10
-
11
- const mockStore = configureMockStore([thunk]);
2
+ import { IntegrationTestHelper } from '@theforeman/test';
3
+ import InventoryFilter from '../index';
4
+ import reducers from '../../../../ForemanRhCloudReducers';
12
5
 
13
6
  describe('InventoryFilter integration test', () => {
14
- it('dispatches filter update action on input change', () => {
15
- const store = mockStore({
16
- ForemanRhCloud: {
17
- inventoryUpload: {
18
- inventoryFilter: { filterTerm: '' },
19
- },
20
- },
21
- });
22
-
23
- render(
24
- <Provider store={store}>
25
- <ConnectedInventoryFilter />
26
- </Provider>
27
- );
28
-
29
- const input = screen.getByPlaceholderText('Filter..');
30
- fireEvent.change(input, { target: { value: 'some_new_filter' } });
31
-
32
- const actions = store.getActions();
33
- const filterAction = actions.find(
34
- a => a.type === INVENTORY_FILTER_UPDATE && a.payload.filterTerm === 'some_new_filter'
7
+ it('should flow', async () => {
8
+ const integrationTestHelper = new IntegrationTestHelper(reducers);
9
+ const wrapper = integrationTestHelper.mount(<InventoryFilter />);
10
+ const input = wrapper.find('input[id="inventory_filter_input"]');
11
+ input.simulate('change', { target: { value: 'some_new_filter' } });
12
+ await IntegrationTestHelper.flushAllPromises();
13
+ wrapper.update();
14
+ integrationTestHelper.takeStoreAndLastActionSnapshot(
15
+ 'filter have been updated'
35
16
  );
36
- expect(filterAction).toBeTruthy();
37
17
  });
38
18
  });
@@ -0,0 +1,9 @@
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
+ import { handleToggle } from '../AdvancedSettingActions';
3
+
4
+ const fixtures = {
5
+ 'should handleToggle': () => handleToggle('autoUploadEnabled', false),
6
+ };
7
+
8
+ describe('AdvancedSetting actions', () =>
9
+ testActionSnapshotWithFixtures(fixtures));
@@ -0,0 +1,18 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`AdvancedSetting actions should handleToggle 1`] = `
4
+ Array [
5
+ Array [
6
+ Object {
7
+ "errorToast": [Function],
8
+ "key": "INVENTORY_SETTINGS",
9
+ "params": Object {
10
+ "setting": "autoUploadEnabled",
11
+ "value": true,
12
+ },
13
+ "type": "post-some-type",
14
+ "url": "/foreman_inventory_upload/setting",
15
+ },
16
+ ],
17
+ ]
18
+ `;
@@ -0,0 +1,14 @@
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
+ import { getSettings, setSetting } from '../InventorySettingsActions';
3
+
4
+ const fixtures = {
5
+ 'should getSettings': () => getSettings(),
6
+ 'should setSetting hostObfuscation true': () =>
7
+ setSetting({
8
+ setting: 'hostObfuscation',
9
+ value: true,
10
+ }),
11
+ };
12
+
13
+ describe('Inventory settings actions', () =>
14
+ testActionSnapshotWithFixtures(fixtures));
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Inventory settings actions should getSettings 1`] = `
4
+ Object {
5
+ "key": "INVENTORY_SETTINGS",
6
+ "type": "get-some-type",
7
+ "url": "/foreman_inventory_upload/settings",
8
+ }
9
+ `;
10
+
11
+ exports[`Inventory settings actions should setSetting hostObfuscation true 1`] = `
12
+ Array [
13
+ Array [
14
+ Object {
15
+ "errorToast": [Function],
16
+ "key": "INVENTORY_SETTINGS",
17
+ "params": Object {
18
+ "setting": "hostObfuscation",
19
+ "value": true,
20
+ },
21
+ "type": "post-some-type",
22
+ "url": "/foreman_inventory_upload/setting",
23
+ },
24
+ ],
25
+ ]
26
+ `;
@@ -1,20 +1,12 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
+
3
3
  import PageTitle from '../PageTitle';
4
4
 
5
- jest.mock('../components/CloudPingModal', () => () => (
6
- <div data-testid="cloud-ping-modal">CloudPingModal</div>
7
- ));
8
- jest.mock('foremanReact/common/helpers', () => ({ getDocsURL: () => {} }));
5
+ const fixtures = {
6
+ 'render without Props': {},
7
+ };
9
8
 
10
9
  describe('PageTitle', () => {
11
- it('renders the page title', () => {
12
- render(<PageTitle />);
13
- expect(screen.getByText('Red Hat Inventory')).toBeTruthy();
14
- });
15
-
16
- it('renders the kebab dropdown', () => {
17
- const { container } = render(<PageTitle />);
18
- expect(container.querySelector('.title-dropdown')).toBeTruthy();
19
- });
10
+ describe('rendering', () =>
11
+ testComponentSnapshotsWithFixtures(PageTitle, fixtures));
20
12
  });
@@ -0,0 +1,68 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`PageTitle rendering render without Props 1`] = `
4
+ <Grid
5
+ className="inventory-upload-header-title"
6
+ >
7
+ <GridItem
8
+ span={6}
9
+ >
10
+ <Head>
11
+ <title>
12
+ Red Hat Inventory
13
+ </title>
14
+ </Head>
15
+ <h1>
16
+ Red Hat Inventory
17
+ </h1>
18
+ </GridItem>
19
+ <GridItem
20
+ span={6}
21
+ >
22
+ <Dropdown
23
+ className="title-dropdown"
24
+ dropdownItems={
25
+ Array [
26
+ <DropdownItem
27
+ href="/foreman_tasks/tasks?search=label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AHostInventoryReportJob+or+label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1"
28
+ ouiaId="tasks-history-button"
29
+ rel="noopener noreferrer"
30
+ target="_blank"
31
+ >
32
+ Actions history
33
+ </DropdownItem>,
34
+ <DropdownItem
35
+ href="/links/manual/?root_url=https%3A%2F%2Fdocs.redhat.com%2Fen%2Fdocumentation%2Fred_hat_lightspeed%2F1-latest%2Fhtml-single%2Fred_hat_lightspeed_remediations_guide%2Findex"
36
+ ouiaId="inventory-documentation-button"
37
+ rel="noopener noreferrer"
38
+ target="_blank"
39
+ >
40
+ Documentation
41
+ </DropdownItem>,
42
+ <DropdownItem
43
+ onClick={[Function]}
44
+ ouiaId="dropdownItem-cloud-ping"
45
+ >
46
+ Connectivity test
47
+ </DropdownItem>,
48
+ ]
49
+ }
50
+ isOpen={false}
51
+ isPlain={true}
52
+ onSelect={[Function]}
53
+ ouiaId="title-dropdown"
54
+ position="right"
55
+ toggle={
56
+ <KebabToggle
57
+ onToggle={[Function]}
58
+ />
59
+ }
60
+ />
61
+ <CloudPingModal
62
+ isOpen={false}
63
+ title="Connectivity test"
64
+ toggle={[Function]}
65
+ />
66
+ </GridItem>
67
+ </Grid>
68
+ `;
@@ -0,0 +1,9 @@
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
+ import { configureCloudConnector } from '../CloudConnectorActions';
3
+
4
+ const fixtures = {
5
+ 'should configureCloudConnector': () => configureCloudConnector(),
6
+ };
7
+
8
+ describe('CloudConnector button actions', () =>
9
+ testActionSnapshotWithFixtures(fixtures));
@@ -1,51 +1,22 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
3
2
  import { CloudConnectorButton } from '../CloudConnectorButton';
4
3
  import { CONNECTOR_STATUS } from '../CloudConnectorConstants';
5
4
 
6
- describe('CloudConnectorButton', () => {
7
- it('renders "Configure cloud connector" when not resolved', () => {
8
- render(
9
- <CloudConnectorButton
10
- status={CONNECTOR_STATUS.NOT_RESOLVED}
11
- onClick={jest.fn()}
12
- />
13
- );
14
- expect(screen.getByRole('button', { name: /Configure cloud connector/ })).toBeTruthy();
15
- });
5
+ const fixtures = {
6
+ 'render no cloud connector': {
7
+ status: CONNECTOR_STATUS.NOT_RESOLVED,
8
+ onClick: jest.fn(),
9
+ },
10
+ 'render resolved cloud connector': {
11
+ status: CONNECTOR_STATUS.RESOLVED,
12
+ onClick: jest.fn(),
13
+ },
14
+ 'render pending connector': {
15
+ jobLink: '/job-link',
16
+ status: CONNECTOR_STATUS.PENDING,
17
+ onClick: jest.fn(),
18
+ },
19
+ };
16
20
 
17
- it('renders "Reconfigure cloud connector" when resolved', () => {
18
- render(
19
- <CloudConnectorButton
20
- status={CONNECTOR_STATUS.RESOLVED}
21
- onClick={jest.fn()}
22
- />
23
- );
24
- expect(screen.getByRole('button', { name: /Reconfigure cloud connector/ })).toBeTruthy();
25
- });
26
-
27
- it('renders in-progress button when pending', () => {
28
- render(
29
- <CloudConnectorButton
30
- status={CONNECTOR_STATUS.PENDING}
31
- onClick={jest.fn()}
32
- jobLink="/job-link"
33
- />
34
- );
35
- expect(
36
- screen.getByText('Cloud Connector is in progress')
37
- ).toBeTruthy();
38
- });
39
-
40
- it('calls onClick when configure button is clicked', () => {
41
- const onClick = jest.fn();
42
- render(
43
- <CloudConnectorButton
44
- status={CONNECTOR_STATUS.NOT_RESOLVED}
45
- onClick={onClick}
46
- />
47
- );
48
- fireEvent.click(screen.getByRole('button', { name: /Configure cloud connector/ }));
49
- expect(onClick).toHaveBeenCalledTimes(1);
50
- });
51
- });
21
+ describe('CloudConnectorButton', () =>
22
+ testComponentSnapshotsWithFixtures(CloudConnectorButton, fixtures));
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CloudConnector button actions should configureCloudConnector 1`] = `
4
+ Object {
5
+ "errorToast": [Function],
6
+ "key": "CONFIGURE_CLOUD_CONNECTOR",
7
+ "successToast": [Function],
8
+ "type": "post-some-type",
9
+ "url": "/foreman_inventory_upload/cloud_connector",
10
+ }
11
+ `;
@@ -0,0 +1,59 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CloudConnectorButton render no cloud connector 1`] = `
4
+ <Button
5
+ onClick={[MockFunction]}
6
+ ouiaId="button-configure"
7
+ variant="secondary"
8
+ >
9
+ Configure cloud connector
10
+ </Button>
11
+ `;
12
+
13
+ exports[`CloudConnectorButton render pending connector 1`] = `
14
+ <Popover
15
+ aria-label="Popover with Link to cloud connector job"
16
+ bodyContent={
17
+ <div>
18
+ Cloud connector setup has started:
19
+ <a
20
+ href="/job-link"
21
+ rel="noopener noreferrer"
22
+ target="_blank"
23
+ >
24
+ view the job in progress
25
+ </a>
26
+ </div>
27
+ }
28
+ closeBtnAriaLabel="Close cloud connector Popover"
29
+ isVisible={false}
30
+ shouldClose={[Function]}
31
+ >
32
+ <div
33
+ className="cloud-connector-pending-button"
34
+ onMouseEnter={[Function]}
35
+ >
36
+ <Button
37
+ isDisabled={true}
38
+ ouiaId="button-in-progress"
39
+ variant="secondary"
40
+ >
41
+ <Spinner
42
+ size="sm"
43
+ />
44
+
45
+ Cloud Connector is in progress
46
+ </Button>
47
+ </div>
48
+ </Popover>
49
+ `;
50
+
51
+ exports[`CloudConnectorButton render resolved cloud connector 1`] = `
52
+ <Button
53
+ onClick={[MockFunction]}
54
+ ouiaId="button-reconfigure"
55
+ variant="secondary"
56
+ >
57
+ Reconfigure cloud connector
58
+ </Button>
59
+ `;
@@ -7,8 +7,6 @@ import { getDocsURL } from 'foremanReact/common/helpers';
7
7
  import { FormattedMessage } from 'react-intl';
8
8
  import { selectSubscriptionConnectionEnabled } from '../../../InventorySettings/InventorySettingsSelectors';
9
9
 
10
- import { getSubscriptionServiceDocsUrl } from '../../../../ForemanInventoryHelpers';
11
-
12
10
  export const PageDescription = () => {
13
11
  const subscriptionConnectionEnabled = useSelector(
14
12
  selectSubscriptionConnectionEnabled
@@ -82,7 +80,7 @@ export const PageDescription = () => {
82
80
  {__('For more information about the Subscriptions service, see:')}
83
81
  &nbsp;
84
82
  <a
85
- href={getSubscriptionServiceDocsUrl()}
83
+ href="https://docs.redhat.com/en/documentation/subscription_central/1-latest/html/getting_started_with_the_subscriptions_service/index"
86
84
  target="_blank"
87
85
  rel="noopener noreferrer"
88
86
  >
@@ -1,61 +1,18 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
3
2
  import { SettingsWarning } from './SettingsWarning';
4
3
 
5
- describe('SettingsWarning', () => {
6
- it('renders nothing when isCloudConnector is false', () => {
7
- render(
8
- <SettingsWarning autoUpload={false} isCloudConnector={false} />
9
- );
10
- expect(screen.queryByRole('alert')).toBeNull();
11
- });
4
+ const fixtures = {
5
+ 'with 2 alerts': {
6
+ autoUpload: false,
7
+ hostObfuscation: true,
8
+ isCloudConnector: true,
9
+ },
10
+ 'with isCloudConnector false': {
11
+ autoUpload: true,
12
+ hostObfuscation: true,
13
+ isCloudConnector: false,
14
+ },
15
+ };
12
16
 
13
- it('renders nothing when autoUpload is on and obfuscation is off', () => {
14
- render(
15
- <SettingsWarning
16
- autoUpload
17
- hostObfuscation={false}
18
- isCloudConnector
19
- />
20
- );
21
- expect(screen.queryByRole('alert')).toBeNull();
22
- });
23
-
24
- it('renders upload warning when autoUpload is disabled', () => {
25
- render(
26
- <SettingsWarning
27
- autoUpload={false}
28
- hostObfuscation={false}
29
- isCloudConnector
30
- />
31
- );
32
- expect(
33
- screen.getByText(/inventory auto-upload is disabled/)
34
- ).toBeTruthy();
35
- });
36
-
37
- it('renders obfuscation warning when hostObfuscation is enabled', () => {
38
- render(
39
- <SettingsWarning autoUpload hostObfuscation isCloudConnector />
40
- );
41
- expect(
42
- screen.getByText(/obfuscating host names setting is enabled/)
43
- ).toBeTruthy();
44
- });
45
-
46
- it('renders both warnings when both conditions met', () => {
47
- render(
48
- <SettingsWarning
49
- autoUpload={false}
50
- hostObfuscation
51
- isCloudConnector
52
- />
53
- );
54
- expect(
55
- screen.getByText(/inventory auto-upload is disabled/)
56
- ).toBeTruthy();
57
- expect(
58
- screen.getByText(/obfuscating host names setting is enabled/)
59
- ).toBeTruthy();
60
- });
61
- });
17
+ describe('SettingsWarning', () =>
18
+ testComponentSnapshotsWithFixtures(SettingsWarning, fixtures));
@@ -0,0 +1,32 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SettingsWarning with 2 alerts 1`] = `
4
+ <div
5
+ className="settings-alert"
6
+ >
7
+ <Alert
8
+ actionClose={
9
+ <AlertActionCloseButton
10
+ onClose={[Function]}
11
+ />
12
+ }
13
+ key="auto-upload"
14
+ ouiaId="auto-upload"
15
+ title="Cloud Connector has been configured however the inventory auto-upload is disabled, it's recommended to enable it"
16
+ variant="warning"
17
+ />
18
+ <Alert
19
+ actionClose={
20
+ <AlertActionCloseButton
21
+ onClose={[Function]}
22
+ />
23
+ }
24
+ key="obfuscating-host"
25
+ ouiaId="obfuscating-host"
26
+ title="Cloud Connector has been configured however obfuscating host names setting is enabled, it's recommended to disable it"
27
+ variant="warning"
28
+ />
29
+ </div>
30
+ `;
31
+
32
+ exports[`SettingsWarning with isCloudConnector false 1`] = `""`;
@@ -39,20 +39,14 @@ export const setupInventorySyncTaskPolling = (id, dispatch) =>
39
39
  key: INVENTORY_SYNC_TASK_UPDATE,
40
40
  onTaskSuccess: ({
41
41
  output: {
42
- host_statuses: { sync, disconnect, user_omitted: userOmitted },
42
+ host_statuses: { sync, disconnect },
43
43
  },
44
44
  }) =>
45
45
  dispatch(
46
46
  addToast({
47
47
  sticky: true,
48
48
  type: 'success',
49
- message: (
50
- <Toast
51
- syncHosts={sync}
52
- disconnectHosts={disconnect}
53
- userOmittedHosts={userOmitted}
54
- />
55
- ),
49
+ message: <Toast syncHosts={sync} disconnectHosts={disconnect} />,
56
50
  })
57
51
  ),
58
52
  dispatch,
@@ -1,27 +1,13 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import SyncButton from '../SyncButton';
4
-
5
- describe('SyncButton', () => {
6
- it('renders the sync button text', () => {
7
- render(<SyncButton handleSync={jest.fn()} />);
8
- expect(screen.getByRole('button', { name: /Sync all inventory status/ })).toBeTruthy();
9
- });
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
+ import { noop } from 'foremanReact/common/helpers';
10
3
 
11
- it('calls handleSync on click', () => {
12
- const handleSync = jest.fn();
13
- render(<SyncButton handleSync={handleSync} />);
14
- fireEvent.click(screen.getByRole('button'));
15
- expect(handleSync).toHaveBeenCalledTimes(1);
16
- });
4
+ import SyncButton from '../SyncButton';
17
5
 
18
- it('disables button when status is PENDING', () => {
19
- render(<SyncButton handleSync={jest.fn()} status="PENDING" />);
20
- expect(screen.getByRole('button').disabled).toBe(true);
21
- });
6
+ const fixtures = {
7
+ 'render with Props': { handleSync: noop },
8
+ };
22
9
 
23
- it('enables button when status is not PENDING', () => {
24
- render(<SyncButton handleSync={jest.fn()} status="RESOLVED" />);
25
- expect(screen.getByRole('button').disabled).toBe(false);
26
- });
10
+ describe('SyncButton', () => {
11
+ describe('rendering', () =>
12
+ testComponentSnapshotsWithFixtures(SyncButton, fixtures));
27
13
  });
@@ -1,29 +1,27 @@
1
+ import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
1
2
  import { selectTaskStatus } from '../SyncButtonSelectors';
2
3
 
3
- const buildState = result => ({
4
+ const state = {
4
5
  API: {
5
6
  INVENTORY_SYNC_TASK_UPDATE: {
6
7
  response: {
7
- result,
8
+ endedAt: '2021-03-08T14:27:30.718+02:00',
9
+ output: {
10
+ host_statuses: {
11
+ sync: 0,
12
+ disconnect: 2,
13
+ },
14
+ },
15
+ result: 'pending',
8
16
  },
17
+ status: 'RESOLVED',
9
18
  },
10
19
  },
11
- });
20
+ };
12
21
 
13
- describe('SyncButton selectors', () => {
14
- it('uppercases the result string', () => {
15
- expect(selectTaskStatus(buildState('pending'))).toBe('PENDING');
16
- });
22
+ const fixtures = {
23
+ 'should return InventorySync status': () => selectTaskStatus(state),
24
+ };
17
25
 
18
- it('handles other result strings', () => {
19
- expect(selectTaskStatus(buildState('success'))).toBe('SUCCESS');
20
- });
21
-
22
- it('returns null when result is not a string', () => {
23
- expect(selectTaskStatus(buildState(null))).toBeNull();
24
- });
25
-
26
- it('returns null when result is undefined', () => {
27
- expect(selectTaskStatus(buildState(undefined))).toBeNull();
28
- });
29
- });
26
+ describe('SyncButton selectors', () =>
27
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SyncButton rendering render with Props 1`] = `
4
+ <Fragment>
5
+ <Button
6
+ className="sync_button"
7
+ isDisabled={false}
8
+ onClick={[Function]}
9
+ ouiaId="sync-button"
10
+ variant="secondary"
11
+ >
12
+ Sync all inventory status
13
+ </Button>
14
+ </Fragment>
15
+ `;
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SyncButton selectors should return InventorySync status 1`] = `"PENDING"`;