foreman_rh_cloud 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -0
  3. data/app/controllers/foreman_inventory_upload/tasks_controller.rb +25 -0
  4. data/app/controllers/insights_cloud/settings_controller.rb +24 -0
  5. data/app/controllers/insights_cloud/tasks_controller.rb +1 -2
  6. data/app/helpers/foreman_inventory_upload_host_helper.rb +10 -1
  7. data/app/models/insights_facet.rb +5 -1
  8. data/app/models/inventory_sync/inventory_status.rb +30 -0
  9. data/app/models/setting/rh_cloud.rb +1 -0
  10. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +1 -1
  11. data/config/routes.rb +3 -0
  12. data/db/migrate/20200727111529_add_uuid_column_to_insights_facets.foreman_rh_cloud.rb +5 -0
  13. data/lib/foreman_inventory_upload.rb +4 -0
  14. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +1 -1
  15. data/lib/foreman_inventory_upload/generators/slice.rb +25 -3
  16. data/lib/foreman_rh_cloud.rb +13 -0
  17. data/lib/foreman_rh_cloud/engine.rb +6 -1
  18. data/lib/foreman_rh_cloud/version.rb +1 -1
  19. data/lib/insights_cloud.rb +8 -8
  20. data/lib/insights_cloud/async/insights_full_sync.rb +17 -10
  21. data/lib/insights_cloud/async/insights_scheduled_sync.rb +23 -0
  22. data/lib/inventory_sync/async/host_result.rb +50 -0
  23. data/lib/inventory_sync/async/inventory_full_sync.rb +99 -0
  24. data/test/controllers/insights_sync/settings_controller_test.rb +30 -0
  25. data/test/factories/insights_factories.rb +31 -0
  26. data/test/jobs/insights_full_sync_test.rb +4 -2
  27. data/test/jobs/inventory_full_sync_test.rb +91 -0
  28. data/test/unit/insights_facet_test.rb +16 -0
  29. data/test/unit/slice_generator_test.rb +15 -7
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +3 -1
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +2 -1
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +2 -0
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +2 -0
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +2 -0
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +1 -0
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +1 -0
  37. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +5 -1
  38. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +1 -0
  39. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +15 -13
  40. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +6 -0
  41. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +1 -1
  42. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +3 -3
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +1 -0
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +1 -0
  45. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +1 -0
  46. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +1 -0
  47. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +52 -0
  48. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +59 -0
  49. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js +3 -0
  50. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js +36 -0
  51. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js +13 -0
  52. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +13 -0
  53. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +13 -0
  54. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js +9 -0
  55. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js +33 -0
  56. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +36 -0
  57. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +26 -0
  58. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap +36 -0
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap +25 -0
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +18 -0
  61. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +63 -0
  62. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +41 -0
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss +20 -0
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +22 -0
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -0
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -0
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +6 -1
  68. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +3 -1
  69. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +2 -0
  70. data/webpack/ForemanRhCloudPages.js +7 -0
  71. data/webpack/ForemanRhCloudTestHelpers.js +12 -3
  72. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +33 -0
  73. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +60 -0
  74. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsConstants.js +10 -0
  75. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsReducer.js +28 -0
  76. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsSelectors.js +6 -0
  77. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettings.test.js +18 -0
  78. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +46 -0
  79. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsReducer.test.js +56 -0
  80. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsSelectors.test.js +21 -0
  81. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +15 -0
  82. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsActions.test.js.snap +31 -0
  83. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsReducer.test.js.snap +33 -0
  84. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsSelectors.test.js.snap +9 -0
  85. data/webpack/InsightsCloudSync/Components/InsightsSettings/index.js +21 -0
  86. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +16 -0
  87. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +1 -0
  88. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +45 -0
  89. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +17 -0
  90. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +38 -0
  91. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +1 -0
  92. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +3 -0
  93. data/webpack/InsightsCloudSync/InsightsCloudSync.js +32 -28
  94. data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +7 -2
  95. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +51 -46
  96. data/webpack/InsightsCloudSync/index.js +2 -1
  97. data/webpack/__mocks__/foremanReact/constants.js +5 -0
  98. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +8 -0
  99. data/webpack/__tests__/ForemanRhCloudSelectors.test.js +4 -1
  100. data/webpack/__tests__/ForemanRhCloudTestHelpers.test.js +12 -2
  101. data/webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap +9 -9
  102. data/webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap +24 -2
  103. data/webpack/index.js +2 -12
  104. metadata +59 -2
@@ -10,7 +10,11 @@ const FullScreenModal = ({
10
10
  toggleFullScreen,
11
11
  terminalProps,
12
12
  }) => (
13
- <Modal show={showFullScreen} onHide={toggleFullScreen}>
13
+ <Modal
14
+ id="full-screen-terminal"
15
+ show={showFullScreen}
16
+ onHide={toggleFullScreen}
17
+ >
14
18
  <Modal.Header>
15
19
  <button
16
20
  className="close"
@@ -8,6 +8,7 @@ exports[`FullScreenModal rendering render without Props 1`] = `
8
8
  bsClass="modal"
9
9
  dialogComponentClass={[Function]}
10
10
  enforceFocus={true}
11
+ id="full-screen-terminal"
11
12
  keyboard={true}
12
13
  manager={
13
14
  ModalManager {
@@ -1,18 +1,20 @@
1
- .modal-dialog {
2
- width: 95%;
3
- height: 95%;
4
- margin: 30px 0 0 30px;
1
+ #full-screen-terminal {
2
+ .modal-dialog {
3
+ width: 95%;
4
+ height: 95%;
5
+ margin: 30px 0 0 30px;
5
6
 
6
- .modal-body {
7
- padding: 0;
8
- display: flex;
9
- height: -webkit-fill-available;
10
- height: -moz-available;
11
- height: fill-available;
7
+ .modal-body {
8
+ padding: 0;
9
+ display: flex;
10
+ height: -webkit-fill-available;
11
+ height: -moz-available;
12
+ height: fill-available;
12
13
 
13
- .terminal {
14
- margin: 0 -20px;
15
- height: 100%;
14
+ .terminal {
15
+ margin: 0 -20px;
16
+ height: 100%;
17
+ }
16
18
  }
17
19
  }
18
20
  }
@@ -14,6 +14,11 @@ Object {
14
14
  ],
15
15
  "state": Object {
16
16
  "ForemanRhCloud": Object {
17
+ "InsightsCloudSync": Object {
18
+ "settings": Object {
19
+ "insightsSyncEnabled": false,
20
+ },
21
+ },
17
22
  "inventoryUpload": Object {
18
23
  "accountsList": Object {
19
24
  "accounts": Object {},
@@ -24,6 +29,7 @@ Object {
24
29
  "inventoryFilter": Object {
25
30
  "filterTerm": "some_new_filter",
26
31
  },
32
+ "inventorySync": Object {},
27
33
  },
28
34
  },
29
35
  },
@@ -26,7 +26,7 @@ const PageHeader = () => (
26
26
  <Grid.Col xs={4}>
27
27
  <InventoryFilter />
28
28
  </Grid.Col>
29
- <Grid.Col xs={4} xsOffset={4}>
29
+ <Grid.Col xs={6} xsOffset={2}>
30
30
  <ToolbarButtons />
31
31
  </Grid.Col>
32
32
  </Grid.Row>
@@ -14,7 +14,7 @@ exports[`PageHeader rendering render without Props 1`] = `
14
14
  <h1
15
15
  className="inventory_title"
16
16
  >
17
- Red Hat Inventory Uploads
17
+ Red Hat Inventory
18
18
  </h1>
19
19
  </Col>
20
20
  </Row>
@@ -51,8 +51,8 @@ exports[`PageHeader rendering render without Props 1`] = `
51
51
  <Col
52
52
  bsClass="col"
53
53
  componentClass="div"
54
- xs={4}
55
- xsOffset={4}
54
+ xs={6}
55
+ xsOffset={2}
56
56
  >
57
57
  <ToolbarButtons />
58
58
  </Col>
@@ -8,6 +8,7 @@ const DocsButton = () => (
8
8
  href={getInventoryDocsUrl()}
9
9
  target="_blank"
10
10
  rel="noopener noreferrer"
11
+ bsSize="lg"
11
12
  >
12
13
  <Icon type="pf" name="help" />
13
14
  {DOCS_BUTTON_TEXT}
@@ -5,6 +5,7 @@ exports[`DocsButton rendering render without Props 1`] = `
5
5
  active={false}
6
6
  block={false}
7
7
  bsClass="btn"
8
+ bsSize="lg"
8
9
  bsStyle="default"
9
10
  disabled={false}
10
11
  href="https://access.redhat.com/products/subscription-central"
@@ -9,6 +9,7 @@ const HistoryButton = () => (
9
9
  href={getActionsHistoryUrl()}
10
10
  target="_blank"
11
11
  rel="noopener noreferrer"
12
+ bsSize="lg"
12
13
  >
13
14
  <Icon name="history" />
14
15
  {ACTIONS_HISTORY_BUTTON_TEXT}
@@ -5,6 +5,7 @@ exports[`HistoryButton rendering render without Props 1`] = `
5
5
  active={false}
6
6
  block={false}
7
7
  bsClass="btn"
8
+ bsSize="lg"
8
9
  bsStyle="default"
9
10
  className="tasks_history_button"
10
11
  disabled={false}
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Button, Icon, Spinner } from 'patternfly-react';
4
+ import { STATUS } from 'foremanReact/constants';
5
+ import SyncModal from './components/Modal';
6
+ import { SYNC_BUTTON_TEXT } from '../../../../ForemanInventoryConstants';
7
+
8
+ class SyncButton extends React.Component {
9
+ state = {
10
+ showModal: false,
11
+ };
12
+
13
+ toggleModal = () => {
14
+ this.setState({ showModal: !this.state.showModal });
15
+ };
16
+
17
+ render() {
18
+ const { cloudToken, handleSync, status } = this.props;
19
+
20
+ const handleClick = !cloudToken ? this.toggleModal : handleSync;
21
+ return (
22
+ <React.Fragment>
23
+ <SyncModal show={this.state.showModal} toggleModal={this.toggleModal} />
24
+ <Button className="sync_button" onClick={handleClick} bsSize="lg">
25
+ {!cloudToken && (
26
+ <span>
27
+ <Icon name="warning" />{' '}
28
+ </span>
29
+ )}
30
+ {status === STATUS.PENDING ? (
31
+ <Spinner loading size="xs" />
32
+ ) : (
33
+ <Icon name="refresh" />
34
+ )}
35
+ {SYNC_BUTTON_TEXT}
36
+ </Button>
37
+ </React.Fragment>
38
+ );
39
+ }
40
+ }
41
+
42
+ SyncButton.propTypes = {
43
+ cloudToken: PropTypes.string.isRequired,
44
+ handleSync: PropTypes.func.isRequired,
45
+ status: PropTypes.string,
46
+ };
47
+
48
+ SyncButton.defaultProps = {
49
+ status: null,
50
+ };
51
+
52
+ export default SyncButton;
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import API from 'foremanReact/API';
3
+ import { addToast } from 'foremanReact/redux/actions/toasts';
4
+ import { inventoryUrl } from '../../../../ForemanInventoryHelpers';
5
+ import Toast from './components/Toast';
6
+ import {
7
+ INVENTORY_SYNC_REQUEST,
8
+ INVENTORY_SYNC_SUCCESS,
9
+ INVENTORY_SYNC_FAILURE,
10
+ } from './SyncButtonConstants';
11
+
12
+ export const handleSync = () => async dispatch => {
13
+ dispatch({
14
+ type: INVENTORY_SYNC_REQUEST,
15
+ payload: {},
16
+ });
17
+ try {
18
+ const {
19
+ data: { syncHosts, disconnectHosts },
20
+ } = await API.post(inventoryUrl('tasks'));
21
+ dispatch({
22
+ type: INVENTORY_SYNC_SUCCESS,
23
+ payload: {
24
+ syncHosts,
25
+ disconnectHosts,
26
+ },
27
+ });
28
+
29
+ dispatch(
30
+ addToast({
31
+ sticky: true,
32
+ type: 'success',
33
+ message: (
34
+ <Toast syncHosts={syncHosts} disconnectHosts={disconnectHosts} />
35
+ ),
36
+ })
37
+ );
38
+ } catch ({
39
+ message,
40
+ response: { data: { message: toastMessage } = {} } = {},
41
+ }) {
42
+ dispatch({
43
+ type: INVENTORY_SYNC_FAILURE,
44
+ payload: {
45
+ error: message,
46
+ },
47
+ });
48
+
49
+ if (toastMessage) {
50
+ dispatch(
51
+ addToast({
52
+ sticky: true,
53
+ type: 'error',
54
+ message: toastMessage,
55
+ })
56
+ );
57
+ }
58
+ }
59
+ };
@@ -0,0 +1,3 @@
1
+ export const INVENTORY_SYNC_REQUEST = 'INVENTORY_SYNC_REQUEST';
2
+ export const INVENTORY_SYNC_SUCCESS = 'INVENTORY_SYNC_SUCCESS';
3
+ export const INVENTORY_SYNC_FAILURE = 'INVENTORY_SYNC_FAILURE';
@@ -0,0 +1,36 @@
1
+ import Immutable from 'seamless-immutable';
2
+ import { STATUS } from 'foremanReact/constants';
3
+ import {
4
+ INVENTORY_SYNC_REQUEST,
5
+ INVENTORY_SYNC_SUCCESS,
6
+ INVENTORY_SYNC_FAILURE,
7
+ } from './SyncButtonConstants';
8
+
9
+ export default (
10
+ state = Immutable({}),
11
+ { type, payload: { syncHosts, disconnectHosts, error } = {} }
12
+ ) => {
13
+ switch (type) {
14
+ case INVENTORY_SYNC_REQUEST:
15
+ return state.merge({
16
+ ...state,
17
+ status: STATUS.PENDING,
18
+ error: null,
19
+ });
20
+ case INVENTORY_SYNC_SUCCESS:
21
+ return state.merge({
22
+ ...state,
23
+ status: STATUS.RESOLVED,
24
+ syncHosts,
25
+ disconnectHosts,
26
+ });
27
+ case INVENTORY_SYNC_FAILURE:
28
+ return state.merge({
29
+ ...state,
30
+ status: STATUS.ERROR,
31
+ error,
32
+ });
33
+ default:
34
+ return state;
35
+ }
36
+ };
@@ -0,0 +1,13 @@
1
+ import { selectForemanInventoryUpload } from '../../../../../ForemanRhCloudSelectors';
2
+
3
+ export const selectInventorySync = state =>
4
+ selectForemanInventoryUpload(state).inventorySync;
5
+
6
+ export const selectStatus = state => selectInventorySync(state).status;
7
+
8
+ export const selectError = state => selectInventorySync(state).error;
9
+
10
+ export const selectSyncHosts = state => selectInventorySync(state).syncHosts;
11
+
12
+ export const selectDisconnectHosts = state =>
13
+ selectInventorySync(state).disconnectHosts;
@@ -0,0 +1,13 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+ import { noop } from 'patternfly-react';
3
+
4
+ import SyncButton from '../SyncButton';
5
+
6
+ const fixtures = {
7
+ 'render with Props': { cloudToken: '1234', handleSync: noop },
8
+ };
9
+
10
+ describe('SyncButton', () => {
11
+ describe('rendering', () =>
12
+ testComponentSnapshotsWithFixtures(SyncButton, fixtures));
13
+ });
@@ -0,0 +1,13 @@
1
+ import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import API from 'foremanReact/API';
3
+ import { handleSync } from '../SyncButtonActions';
4
+ import { successResponse } from './SyncButtonFixtures';
5
+
6
+ jest.mock('foremanReact/API');
7
+ API.post.mockImplementation(async () => successResponse);
8
+
9
+ const fixtures = {
10
+ 'should handleSync': () => handleSync(),
11
+ };
12
+
13
+ describe('SyncButton actions', () => testActionSnapshotWithFixtures(fixtures));
@@ -0,0 +1,9 @@
1
+ export const syncHosts = 1;
2
+
3
+ export const disconnectHosts = 0;
4
+
5
+ export const successResponse = { data: { syncHosts, disconnectHosts } };
6
+
7
+ export const status = 'RESOLVED';
8
+
9
+ export const error = 'some-error';
@@ -0,0 +1,33 @@
1
+ import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import reducer from '../SyncButtonReducer';
3
+ import { syncHosts, disconnectHosts, error } from './SyncButtonFixtures';
4
+ import {
5
+ INVENTORY_SYNC_REQUEST,
6
+ INVENTORY_SYNC_SUCCESS,
7
+ INVENTORY_SYNC_FAILURE,
8
+ } from '../SyncButtonConstants';
9
+
10
+ const fixtures = {
11
+ 'should return the initial state': {},
12
+ 'should handle INVENTORY_SYNC_REQUEST': {
13
+ action: {
14
+ type: INVENTORY_SYNC_REQUEST,
15
+ payload: {},
16
+ },
17
+ },
18
+ 'should handle INVENTORY_SYNC_SUCCESS': {
19
+ action: {
20
+ type: INVENTORY_SYNC_SUCCESS,
21
+ payload: { syncHosts, disconnectHosts },
22
+ },
23
+ },
24
+ 'should handle INVENTORY_SYNC_FAILURE': {
25
+ action: {
26
+ type: INVENTORY_SYNC_FAILURE,
27
+ payload: { error },
28
+ },
29
+ },
30
+ };
31
+
32
+ describe('AccountList reducer', () =>
33
+ testReducerSnapshotWithFixtures(reducer, fixtures));
@@ -0,0 +1,36 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import { inventoryStateWrapper } from '../../../../../../ForemanRhCloudTestHelpers';
3
+ import {
4
+ status,
5
+ error,
6
+ syncHosts,
7
+ disconnectHosts,
8
+ } from './SyncButtonFixtures';
9
+ import {
10
+ selectInventorySync,
11
+ selectStatus,
12
+ selectError,
13
+ selectSyncHosts,
14
+ selectDisconnectHosts,
15
+ } from '../SyncButtonSelectors';
16
+
17
+ const state = inventoryStateWrapper({
18
+ inventorySync: {
19
+ status,
20
+ error,
21
+ syncHosts,
22
+ disconnectHosts,
23
+ },
24
+ });
25
+
26
+ const fixtures = {
27
+ 'should return InventorySync': () => selectInventorySync(state),
28
+ 'should return InventorySync status': () => selectStatus(state),
29
+ 'should return InventorySync error': () => selectError(state),
30
+ 'should return InventorySync SyncHosts': () => selectSyncHosts(state),
31
+ 'should return InventorySync disconnectHosts': () =>
32
+ selectDisconnectHosts(state),
33
+ };
34
+
35
+ describe('SyncButton selectors', () =>
36
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SyncButton rendering render with Props 1`] = `
4
+ <Fragment>
5
+ <SyncModal
6
+ show={false}
7
+ toggleModal={[Function]}
8
+ />
9
+ <Button
10
+ active={false}
11
+ block={false}
12
+ bsClass="btn"
13
+ bsSize="lg"
14
+ bsStyle="default"
15
+ className="sync_button"
16
+ disabled={false}
17
+ onClick={[Function]}
18
+ >
19
+ <Icon
20
+ name="refresh"
21
+ type="fa"
22
+ />
23
+ Sync inventory status
24
+ </Button>
25
+ </Fragment>
26
+ `;