passbolt-styleguide 5.14.0 → 5.14.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.
- package/RELEASE_NOTES.md +3 -2
- package/build/css/help.min.css +2 -2
- package/build/css/public.min.css +2 -2
- package/build/css/themes/default/api_authentication.min.css +2 -2
- package/build/css/themes/default/api_cloud.min.css +2 -2
- package/build/css/themes/default/api_main.min.css +2 -2
- package/build/css/themes/default/api_reports.min.css +2 -2
- package/build/css/themes/default/api_webinstaller.min.css +2 -2
- package/build/css/themes/default/ext_app.min.css +2 -2
- package/build/css/themes/default/ext_authentication.min.css +2 -2
- package/build/css/themes/default/ext_external.min.css +2 -2
- package/build/css/themes/default/ext_in_form_cta.min.css +2 -2
- package/build/css/themes/default/ext_in_form_menu.min.css +2 -2
- package/build/css/themes/default/ext_quickaccess.min.css +2 -2
- package/build/css/themes/midgar/api_authentication.min.css +2 -2
- package/build/css/themes/midgar/api_main.min.css +2 -2
- package/build/css/themes/midgar/api_reports.min.css +2 -2
- package/build/css/themes/midgar/ext_app.min.css +2 -2
- package/build/css/themes/midgar/ext_authentication.min.css +2 -2
- package/build/css/themes/midgar/ext_in_form_cta.min.css +2 -2
- package/build/css/themes/midgar/ext_in_form_menu.min.css +2 -2
- package/build/css/themes/midgar/ext_quickaccess.min.css +2 -2
- package/build/css/themes/solarized_dark/api_authentication.min.css +2 -2
- package/build/css/themes/solarized_dark/api_main.min.css +2 -2
- package/build/css/themes/solarized_dark/api_reports.min.css +2 -2
- package/build/css/themes/solarized_dark/ext_app.min.css +2 -2
- package/build/css/themes/solarized_dark/ext_authentication.min.css +2 -2
- package/build/css/themes/solarized_dark/ext_in_form_cta.min.css +2 -2
- package/build/css/themes/solarized_dark/ext_in_form_menu.min.css +2 -2
- package/build/css/themes/solarized_dark/ext_quickaccess.min.css +2 -2
- package/build/css/themes/solarized_light/api_authentication.min.css +2 -2
- package/build/css/themes/solarized_light/api_main.min.css +2 -2
- package/build/css/themes/solarized_light/api_reports.min.css +2 -2
- package/build/css/themes/solarized_light/ext_app.min.css +2 -2
- package/build/css/themes/solarized_light/ext_authentication.min.css +2 -2
- package/build/css/themes/solarized_light/ext_in_form_cta.min.css +2 -2
- package/build/css/themes/solarized_light/ext_in_form_menu.min.css +2 -2
- package/build/css/themes/solarized_light/ext_quickaccess.min.css +2 -2
- package/build/js/dist/api-app.js +1 -1
- package/build/locales/pl-PL/common.json +2 -2
- package/package.json +1 -1
- package/src/locales/pl-PL/common.json +2 -2
- package/src/react-extension/components/Administration/DowngradeToCe/DowngradeToCe.js +1 -1
- package/src/react-extension/components/Resource/CreateResource/CreateResource.js +11 -1
- package/src/react-extension/components/Resource/CreateResource/CreateResource.test.data.js +2 -0
- package/src/react-extension/components/Resource/CreateResource/CreateResource.test.js +2 -2
- package/src/react-extension/components/Resource/EditResource/EditResource.js +17 -41
- package/src/react-extension/components/Resource/EditResource/EditResource.test.data.js +2 -0
- package/src/react-extension/components/Resource/EditResource/EditResource.test.js +56 -170
- package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceCreationFlow.js +31 -7
- package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceCreationFlow.test.js +4 -3
- package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceEditFlow.js +40 -17
- package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceEditFlow.test.js +14 -8
- package/src/react-extension/components/Share/GroupPermissionItem.js +6 -3
- package/src/react-extension/components/Share/ShareDialog.js +14 -1
- package/src/react-extension/components/Share/UserPermissionItem.js +6 -3
- package/src/react-extension/components/Share/Utility/ShareChanges.js +12 -0
- package/src/shared/context/ResourceTypesLocalStorageContext/ResourceTypesLocalStorageContext.js +2 -2
- package/src/shared/context/ResourceTypesLocalStorageContext/ResourceTypesLocalStorageContext.test.js +3 -3
- package/src/shared/services/permission/permissionChangesService.js +1 -5
- package/src/shared/services/permission/permissionChangesService.test.js +18 -42
|
@@ -1323,8 +1323,8 @@
|
|
|
1323
1323
|
"Tags management": "Zarządzanie tagami",
|
|
1324
1324
|
"Tags starting with # are shared with all users who have access. Separate tags using commas.": "Tagi zaczynające się od znaku # są udostępniane wszystkim użytkownikom, którzy mają dostęp. Oddziel tagi przecinkami.",
|
|
1325
1325
|
"Take a deep breath and enjoy being in the present moment...": "Weź głęboki wdech i naciesz się tą chwilą...",
|
|
1326
|
-
"Tenant ID": "
|
|
1327
|
-
"Tenant ID is required.": "
|
|
1326
|
+
"Tenant ID": "ID grupy dostępowej",
|
|
1327
|
+
"Tenant ID is required.": "ID grupy dostępowej jest wymagane.",
|
|
1328
1328
|
"Terms & Credits": "Warunki i podziękowania",
|
|
1329
1329
|
"Test settings": "Testuj ustawienia",
|
|
1330
1330
|
"Test settings report": "Przetestuj raport ustawień",
|
package/package.json
CHANGED
|
@@ -1323,8 +1323,8 @@
|
|
|
1323
1323
|
"Tags management": "Zarządzanie tagami",
|
|
1324
1324
|
"Tags starting with # are shared with all users who have access. Separate tags using commas.": "Tagi zaczynające się od znaku # są udostępniane wszystkim użytkownikom, którzy mają dostęp. Oddziel tagi przecinkami.",
|
|
1325
1325
|
"Take a deep breath and enjoy being in the present moment...": "Weź głęboki wdech i naciesz się tą chwilą...",
|
|
1326
|
-
"Tenant ID": "
|
|
1327
|
-
"Tenant ID is required.": "
|
|
1326
|
+
"Tenant ID": "ID grupy dostępowej",
|
|
1327
|
+
"Tenant ID is required.": "ID grupy dostępowej jest wymagane.",
|
|
1328
1328
|
"Terms & Credits": "Warunki i podziękowania",
|
|
1329
1329
|
"Test settings": "Testuj ustawienia",
|
|
1330
1330
|
"Test settings report": "Przetestuj raport ustawień",
|
|
@@ -41,7 +41,7 @@ import SpinnerSVG from "../../../../img/svg/spinner.svg";
|
|
|
41
41
|
import SSOSVG from "../../../../img/svg/sso.svg";
|
|
42
42
|
import TagsSVG from "../../../../img/svg/tags.svg";
|
|
43
43
|
|
|
44
|
-
export const LEARN_MORE_URL = "https://www.passbolt.com/docs";
|
|
44
|
+
export const LEARN_MORE_URL = "https://www.passbolt.com/docs/hosting/manage-plan/downgrade";
|
|
45
45
|
|
|
46
46
|
class DowngradeToCe extends React.Component {
|
|
47
47
|
/**
|
|
@@ -86,6 +86,7 @@ class CreateResource extends Component {
|
|
|
86
86
|
this.rejectCreationConfirmation = this.rejectCreationConfirmation.bind(this);
|
|
87
87
|
this.consumePasswordEntropyError = this.consumePasswordEntropyError.bind(this);
|
|
88
88
|
this.save = this.save.bind(this);
|
|
89
|
+
this.props.setFocusBackListener(this.handleFocusBack.bind(this));
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
/**
|
|
@@ -410,7 +411,6 @@ class CreateResource extends Component {
|
|
|
410
411
|
*/
|
|
411
412
|
async save(resource) {
|
|
412
413
|
await this.props.onSubmit(resource);
|
|
413
|
-
this.handleClose();
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
/*
|
|
@@ -502,6 +502,15 @@ class CreateResource extends Component {
|
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Triggered when the dialog should have the focus back.
|
|
507
|
+
*/
|
|
508
|
+
handleFocusBack() {
|
|
509
|
+
this.setState({
|
|
510
|
+
isProcessing: false,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
|
|
505
514
|
/**
|
|
506
515
|
* Get the expiration date on the given resource according to the password expiry settings.
|
|
507
516
|
* The value is set to `undefined` if the feature is not activated,
|
|
@@ -612,6 +621,7 @@ CreateResource.propTypes = {
|
|
|
612
621
|
passwordPoliciesContext: PropTypes.object, // The password policy context
|
|
613
622
|
resourceTypes: PropTypes.instanceOf(ResourceTypesCollection), // The resource types collection
|
|
614
623
|
resourceType: PropTypes.instanceOf(ResourceTypeEntity).isRequired, // The resource types entity
|
|
624
|
+
setFocusBackListener: PropTypes.func, // Event handler for handling focusing back on this dialog
|
|
615
625
|
t: PropTypes.func, // The translation function
|
|
616
626
|
};
|
|
617
627
|
|
|
@@ -58,6 +58,8 @@ export function defaultProps(data = {}) {
|
|
|
58
58
|
dialogContext: defaultDialogContext(),
|
|
59
59
|
clipboardContext: defaultClipboardContext(),
|
|
60
60
|
onConfirm: jest.fn(),
|
|
61
|
+
onSubmit: jest.fn(),
|
|
62
|
+
setFocusBackListener: jest.fn(),
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
return Object.assign(defaultData, data);
|
|
@@ -1288,11 +1288,11 @@ describe("See the Create Resource", () => {
|
|
|
1288
1288
|
});
|
|
1289
1289
|
resolveSubmit();
|
|
1290
1290
|
await waitFor(() => {
|
|
1291
|
-
if (!props.
|
|
1291
|
+
if (!props.onSubmit.mock.calls.length) {
|
|
1292
1292
|
throw new Error("onClose not yet invoked");
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
|
-
expect(props.
|
|
1295
|
+
expect(props.onSubmit).toHaveBeenCalledTimes(1);
|
|
1296
1296
|
});
|
|
1297
1297
|
});
|
|
1298
1298
|
});
|
|
@@ -91,6 +91,7 @@ class EditResource extends Component {
|
|
|
91
91
|
this.rejectEditionConfirmation = this.rejectEditionConfirmation.bind(this);
|
|
92
92
|
this.consumePasswordEntropyError = this.consumePasswordEntropyError.bind(this);
|
|
93
93
|
this.save = this.save.bind(this);
|
|
94
|
+
this.props.setFocusBackListener(this.handleFocusBack.bind(this));
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
/**
|
|
@@ -480,53 +481,18 @@ class EditResource extends Component {
|
|
|
480
481
|
* @returns {Promise<void>}
|
|
481
482
|
*/
|
|
482
483
|
async save(resource) {
|
|
483
|
-
if (this.props.onSubmit) {
|
|
484
|
-
await this.props.onSubmit(resource);
|
|
485
|
-
this.handleClose();
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
await this.updateResource(resource);
|
|
489
|
-
await this.handleSaveSuccess();
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/*
|
|
493
|
-
* =============================================================
|
|
494
|
-
* Update resource
|
|
495
|
-
* =============================================================
|
|
496
|
-
*/
|
|
497
|
-
/**
|
|
498
|
-
* Update the resource
|
|
499
|
-
* @param {ResourceFormEntity} resource
|
|
500
|
-
* @returns {Promise<void>}
|
|
501
|
-
*/
|
|
502
|
-
async updateResource(resource) {
|
|
503
484
|
const isSecretChanged = resource.secret.areSecretsDifferent(this.state.originalSecret);
|
|
504
|
-
if (this.props.resource.resource_type_id === resource.resourceTypeId) {
|
|
505
|
-
if (!isSecretChanged) {
|
|
506
|
-
await this.props.context.port.request("passbolt.resources.update", resource.toResourceDto(), null);
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
485
|
if (isSecretChanged && this.shouldUpdateExpirationDate()) {
|
|
512
486
|
resource.set("expired", this.getResourceExpirationDate());
|
|
513
487
|
}
|
|
514
488
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
489
|
+
let secretDto = null;
|
|
490
|
+
if (isSecretChanged || this.props.resource.resource_type_id !== resource.resourceTypeId) {
|
|
491
|
+
const resourceType = this.props.resourceTypes.getFirstById(resource.resourceTypeId);
|
|
492
|
+
secretDto = resourceType.isPasswordString() ? resource.toSecretDto().password : resource.toSecretDto();
|
|
493
|
+
}
|
|
521
494
|
|
|
522
|
-
|
|
523
|
-
* Handle save operation success.
|
|
524
|
-
* @returns {Promise<void>}
|
|
525
|
-
*/
|
|
526
|
-
async handleSaveSuccess() {
|
|
527
|
-
await this.props.actionFeedbackContext.displaySuccess(this.translate("The resource has been updated successfully"));
|
|
528
|
-
this.props.resourceWorkspaceContext.onResourceEdited();
|
|
529
|
-
this.handleClose();
|
|
495
|
+
await this.props.onSubmit(resource, secretDto);
|
|
530
496
|
}
|
|
531
497
|
|
|
532
498
|
/*
|
|
@@ -618,6 +584,15 @@ class EditResource extends Component {
|
|
|
618
584
|
});
|
|
619
585
|
}
|
|
620
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Triggered when the dialog should have the focus back.
|
|
589
|
+
*/
|
|
590
|
+
handleFocusBack() {
|
|
591
|
+
this.setState({
|
|
592
|
+
isProcessing: false,
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
|
|
621
596
|
/**
|
|
622
597
|
* Is allowed to convert a note
|
|
623
598
|
* @returns {boolean}
|
|
@@ -775,6 +750,7 @@ EditResource.propTypes = {
|
|
|
775
750
|
actionFeedbackContext: PropTypes.any, // The action feedback context
|
|
776
751
|
resourceTypes: PropTypes.instanceOf(ResourceTypesCollection), // The resource types collection
|
|
777
752
|
metadataTypeSettings: PropTypes.instanceOf(MetadataTypesSettingsEntity), // The metadata type settings
|
|
753
|
+
setFocusBackListener: PropTypes.func, // Event handler for handling focusing back on this dialog
|
|
778
754
|
t: PropTypes.func, // The translation function
|
|
779
755
|
};
|
|
780
756
|
|
|
@@ -66,6 +66,8 @@ export function defaultProps(data = {}) {
|
|
|
66
66
|
onClose: jest.fn(),
|
|
67
67
|
dialogContext: defaultDialogContext(),
|
|
68
68
|
clipboardContext: defaultClipboardContext(),
|
|
69
|
+
setFocusBackListener: jest.fn(),
|
|
70
|
+
onSubmit: jest.fn(),
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
return Object.assign(defaultData, data);
|
|
@@ -282,7 +282,7 @@ describe("See the Create Resource", () => {
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
it("As a signed-in user I should be able to delete secret custom fields without a resource type mutation", async () => {
|
|
285
|
-
expect.assertions(
|
|
285
|
+
expect.assertions(5);
|
|
286
286
|
|
|
287
287
|
const props = defaultProps();
|
|
288
288
|
mockContextRequest(props.context, () => ({
|
|
@@ -330,19 +330,12 @@ describe("See the Create Resource", () => {
|
|
|
330
330
|
};
|
|
331
331
|
|
|
332
332
|
// expectations
|
|
333
|
-
expect(props.
|
|
334
|
-
|
|
335
|
-
resourceDtoExpected,
|
|
336
|
-
secretDtoExpected,
|
|
337
|
-
);
|
|
338
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
339
|
-
"The resource has been updated successfully",
|
|
340
|
-
);
|
|
341
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
333
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
334
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
342
335
|
});
|
|
343
336
|
|
|
344
337
|
it("As LU operated by a workflow (onSubmit provided) I should delegate the save and not call passbolt.resources.update", async () => {
|
|
345
|
-
expect.assertions(
|
|
338
|
+
expect.assertions(2);
|
|
346
339
|
|
|
347
340
|
const onSubmit = jest.fn();
|
|
348
341
|
const props = defaultProps({ onSubmit });
|
|
@@ -355,12 +348,7 @@ describe("See the Create Resource", () => {
|
|
|
355
348
|
|
|
356
349
|
// The workflow owns the API call: EditResource hands it the form entity and closes.
|
|
357
350
|
expect(onSubmit).toHaveBeenCalledTimes(1);
|
|
358
|
-
expect(props.
|
|
359
|
-
"passbolt.resources.update",
|
|
360
|
-
expect.anything(),
|
|
361
|
-
expect.anything(),
|
|
362
|
-
);
|
|
363
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
351
|
+
expect(props.onSubmit).not.toHaveBeenCalledWith(expect.anything(), expect.anything());
|
|
364
352
|
});
|
|
365
353
|
|
|
366
354
|
it("As a signed-in user I should be able to delete secret with a resource type mutation", async () => {
|
|
@@ -1351,7 +1339,7 @@ describe("See the Create Resource", () => {
|
|
|
1351
1339
|
|
|
1352
1340
|
const error = new Error("unexpected error");
|
|
1353
1341
|
jest.spyOn(props.dialogContext, "open").mockImplementationOnce((component, props) => props.onConfirm());
|
|
1354
|
-
|
|
1342
|
+
props.onSubmit.mockImplementation(() => {
|
|
1355
1343
|
throw error;
|
|
1356
1344
|
});
|
|
1357
1345
|
|
|
@@ -1466,7 +1454,7 @@ describe("See the Create Resource", () => {
|
|
|
1466
1454
|
|
|
1467
1455
|
const error = new Error("unexpected error");
|
|
1468
1456
|
jest.spyOn(props.dialogContext, "open").mockImplementationOnce((component, props) => props.onConfirm());
|
|
1469
|
-
|
|
1457
|
+
props.onSubmit.mockImplementation(() => {
|
|
1470
1458
|
throw error;
|
|
1471
1459
|
});
|
|
1472
1460
|
|
|
@@ -1554,7 +1542,7 @@ describe("See the Create Resource", () => {
|
|
|
1554
1542
|
|
|
1555
1543
|
describe("should save a secret to a resource", () => {
|
|
1556
1544
|
it("As a signed-in user I should be able to save a resource v5 default", async () => {
|
|
1557
|
-
expect.assertions(
|
|
1545
|
+
expect.assertions(2);
|
|
1558
1546
|
const expirationPeriod = 15;
|
|
1559
1547
|
const passwordExpirySettings = overridenPasswordExpirySettingsEntityDto({
|
|
1560
1548
|
default_expiry_period: expirationPeriod,
|
|
@@ -1607,19 +1595,12 @@ describe("See the Create Resource", () => {
|
|
|
1607
1595
|
};
|
|
1608
1596
|
|
|
1609
1597
|
// expectations
|
|
1610
|
-
expect(props.
|
|
1611
|
-
|
|
1612
|
-
resourceDtoExpected,
|
|
1613
|
-
secretDtoExpected,
|
|
1614
|
-
);
|
|
1615
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1616
|
-
"The resource has been updated successfully",
|
|
1617
|
-
);
|
|
1618
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1598
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1599
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1619
1600
|
});
|
|
1620
1601
|
|
|
1621
1602
|
it("As a signed-in user I should be able to save a resource v5 default with no expiry update", async () => {
|
|
1622
|
-
expect.assertions(
|
|
1603
|
+
expect.assertions(2);
|
|
1623
1604
|
const expirationPeriod = 15;
|
|
1624
1605
|
const passwordExpirySettings = overridenPasswordExpirySettingsEntityDto({
|
|
1625
1606
|
default_expiry_period: expirationPeriod,
|
|
@@ -1673,19 +1654,12 @@ describe("See the Create Resource", () => {
|
|
|
1673
1654
|
};
|
|
1674
1655
|
|
|
1675
1656
|
// expectations
|
|
1676
|
-
expect(props.
|
|
1677
|
-
|
|
1678
|
-
resourceDtoExpected,
|
|
1679
|
-
secretDtoExpected,
|
|
1680
|
-
);
|
|
1681
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1682
|
-
"The resource has been updated successfully",
|
|
1683
|
-
);
|
|
1684
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1657
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1658
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1685
1659
|
});
|
|
1686
1660
|
|
|
1687
1661
|
it("As a signed-in user I should be able to save a resource v5 default with totp empty", async () => {
|
|
1688
|
-
expect.assertions(
|
|
1662
|
+
expect.assertions(2);
|
|
1689
1663
|
const props = defaultProps({
|
|
1690
1664
|
resource: defaultResourceDto({
|
|
1691
1665
|
resource_type_id: TEST_RESOURCE_TYPE_V5_DEFAULT,
|
|
@@ -1732,19 +1706,12 @@ describe("See the Create Resource", () => {
|
|
|
1732
1706
|
};
|
|
1733
1707
|
|
|
1734
1708
|
// expectations
|
|
1735
|
-
expect(props.
|
|
1736
|
-
|
|
1737
|
-
resourceDtoExpected,
|
|
1738
|
-
secretDtoExpected,
|
|
1739
|
-
);
|
|
1740
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1741
|
-
"The resource has been updated successfully",
|
|
1742
|
-
);
|
|
1743
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1709
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1710
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1744
1711
|
});
|
|
1745
1712
|
|
|
1746
1713
|
it("As a signed-in user I should be able to save a resource v5 default with totp and custom fields", async () => {
|
|
1747
|
-
expect.assertions(
|
|
1714
|
+
expect.assertions(2);
|
|
1748
1715
|
const props = defaultProps();
|
|
1749
1716
|
mockContextRequest(props.context, () => ({ password: "password" }));
|
|
1750
1717
|
let page;
|
|
@@ -1778,13 +1745,11 @@ describe("See the Create Resource", () => {
|
|
|
1778
1745
|
await page.click(page.addUri);
|
|
1779
1746
|
await page.fillInput(page.getAdditionalUri(1), "https://www.passbolt.com/docs");
|
|
1780
1747
|
|
|
1781
|
-
const customFields = {};
|
|
1782
|
-
mockContextRequest(
|
|
1783
|
-
props.context,
|
|
1784
|
-
jest.fn(async (message, arg1) => Object.assign(customFields, arg1.metadata.custom_fields)),
|
|
1785
|
-
);
|
|
1786
1748
|
await page.click(page.saveButton);
|
|
1787
1749
|
|
|
1750
|
+
const resourceDto = props.onSubmit.mock.calls[0][0].toResourceDto();
|
|
1751
|
+
const customFields = resourceDto.metadata.custom_fields;
|
|
1752
|
+
|
|
1788
1753
|
const resourceDtoExpected = {
|
|
1789
1754
|
id: props.resource.id,
|
|
1790
1755
|
expired: null,
|
|
@@ -1832,19 +1797,12 @@ describe("See the Create Resource", () => {
|
|
|
1832
1797
|
};
|
|
1833
1798
|
|
|
1834
1799
|
// expectations
|
|
1835
|
-
expect(props.
|
|
1836
|
-
|
|
1837
|
-
resourceDtoExpected,
|
|
1838
|
-
secretDtoExpected,
|
|
1839
|
-
);
|
|
1840
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1841
|
-
"The resource has been updated successfully",
|
|
1842
|
-
);
|
|
1843
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1800
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1801
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1844
1802
|
});
|
|
1845
1803
|
|
|
1846
1804
|
it("As a signed-in user I should be able to save a resource v5 default with totp with password null", async () => {
|
|
1847
|
-
expect.assertions(
|
|
1805
|
+
expect.assertions(2);
|
|
1848
1806
|
const props = defaultProps();
|
|
1849
1807
|
mockContextRequest(props.context, () => ({ object_type: SECRET_DATA_OBJECT_TYPE, password: "password" }));
|
|
1850
1808
|
let page;
|
|
@@ -1892,19 +1850,12 @@ describe("See the Create Resource", () => {
|
|
|
1892
1850
|
};
|
|
1893
1851
|
|
|
1894
1852
|
// expectations
|
|
1895
|
-
expect(props.
|
|
1896
|
-
|
|
1897
|
-
resourceDtoExpected,
|
|
1898
|
-
secretDtoExpected,
|
|
1899
|
-
);
|
|
1900
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1901
|
-
"The resource has been updated successfully",
|
|
1902
|
-
);
|
|
1903
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1853
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1854
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1904
1855
|
});
|
|
1905
1856
|
|
|
1906
1857
|
it("As a signed-in user I should be able to save a resource v5 totp after password, custom fields and note deleted", async () => {
|
|
1907
|
-
expect.assertions(
|
|
1858
|
+
expect.assertions(2);
|
|
1908
1859
|
const props = defaultProps();
|
|
1909
1860
|
mockContextRequest(props.context, () => ({
|
|
1910
1861
|
object_type: SECRET_DATA_OBJECT_TYPE,
|
|
@@ -1954,19 +1905,12 @@ describe("See the Create Resource", () => {
|
|
|
1954
1905
|
};
|
|
1955
1906
|
|
|
1956
1907
|
// expectations
|
|
1957
|
-
expect(props.
|
|
1958
|
-
|
|
1959
|
-
resourceDtoExpected,
|
|
1960
|
-
secretDtoExpected,
|
|
1961
|
-
);
|
|
1962
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
1963
|
-
"The resource has been updated successfully",
|
|
1964
|
-
);
|
|
1965
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1908
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1909
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
1966
1910
|
});
|
|
1967
1911
|
|
|
1968
1912
|
it("As a signed-in user I should be able to save a resource v5 standalone custom fields", async () => {
|
|
1969
|
-
expect.assertions(
|
|
1913
|
+
expect.assertions(3);
|
|
1970
1914
|
const props = defaultCustomFieldsProps();
|
|
1971
1915
|
mockContextRequest(props.context, () => ({
|
|
1972
1916
|
object_type: SECRET_DATA_OBJECT_TYPE,
|
|
@@ -1986,13 +1930,11 @@ describe("See the Create Resource", () => {
|
|
|
1986
1930
|
|
|
1987
1931
|
await page.fillInput(page.name, "v5 standalone custom fields");
|
|
1988
1932
|
|
|
1989
|
-
const customFields = {};
|
|
1990
|
-
mockContextRequest(
|
|
1991
|
-
props.context,
|
|
1992
|
-
jest.fn(async (message, arg1) => Object.assign(customFields, arg1.metadata.custom_fields)),
|
|
1993
|
-
);
|
|
1994
1933
|
await page.click(page.saveButton);
|
|
1995
1934
|
|
|
1935
|
+
const resourceDto = props.onSubmit.mock.calls[0][0].toResourceDto();
|
|
1936
|
+
const customFields = resourceDto.metadata.custom_fields;
|
|
1937
|
+
|
|
1996
1938
|
const resourceDtoExpected = {
|
|
1997
1939
|
id: props.resource.id,
|
|
1998
1940
|
expired: null,
|
|
@@ -2037,19 +1979,12 @@ describe("See the Create Resource", () => {
|
|
|
2037
1979
|
};
|
|
2038
1980
|
|
|
2039
1981
|
// expectations
|
|
2040
|
-
expect(props.
|
|
2041
|
-
|
|
2042
|
-
resourceDtoExpected,
|
|
2043
|
-
secretDtoExpected,
|
|
2044
|
-
);
|
|
2045
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2046
|
-
"The resource has been updated successfully",
|
|
2047
|
-
);
|
|
2048
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
1982
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
1983
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2049
1984
|
});
|
|
2050
1985
|
|
|
2051
1986
|
it("As a signed-in user I should be able to save a resource v4 default with password deleted", async () => {
|
|
2052
|
-
expect.assertions(
|
|
1987
|
+
expect.assertions(2);
|
|
2053
1988
|
const props = defaultProps({
|
|
2054
1989
|
resource: defaultResourceDto({
|
|
2055
1990
|
metadata: defaultResourceMetadataDto({
|
|
@@ -2096,19 +2031,12 @@ describe("See the Create Resource", () => {
|
|
|
2096
2031
|
};
|
|
2097
2032
|
|
|
2098
2033
|
// expectations
|
|
2099
|
-
expect(props.
|
|
2100
|
-
|
|
2101
|
-
resourceDtoExpected,
|
|
2102
|
-
secretDtoExpected,
|
|
2103
|
-
);
|
|
2104
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2105
|
-
"The resource has been updated successfully",
|
|
2106
|
-
);
|
|
2107
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2034
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2035
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2108
2036
|
});
|
|
2109
2037
|
|
|
2110
2038
|
it("As a signed-in user I should be able to save a resource v4 default totp with password deleted", async () => {
|
|
2111
|
-
expect.assertions(
|
|
2039
|
+
expect.assertions(2);
|
|
2112
2040
|
const props = defaultProps({
|
|
2113
2041
|
resource: defaultResourceDto({
|
|
2114
2042
|
metadata: defaultResourceMetadataDto({
|
|
@@ -2161,19 +2089,12 @@ describe("See the Create Resource", () => {
|
|
|
2161
2089
|
};
|
|
2162
2090
|
|
|
2163
2091
|
// expectations
|
|
2164
|
-
expect(props.
|
|
2165
|
-
|
|
2166
|
-
resourceDtoExpected,
|
|
2167
|
-
secretDtoExpected,
|
|
2168
|
-
);
|
|
2169
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2170
|
-
"The resource has been updated successfully",
|
|
2171
|
-
);
|
|
2172
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2092
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2093
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2173
2094
|
});
|
|
2174
2095
|
|
|
2175
2096
|
it("As a signed-in user I should be able to save a resource v4 default totp", async () => {
|
|
2176
|
-
expect.assertions(
|
|
2097
|
+
expect.assertions(2);
|
|
2177
2098
|
const props = defaultProps({
|
|
2178
2099
|
resource: defaultResourceDto({ resource_type_id: TEST_RESOURCE_TYPE_PASSWORD_STRING }),
|
|
2179
2100
|
});
|
|
@@ -2215,19 +2136,12 @@ describe("See the Create Resource", () => {
|
|
|
2215
2136
|
};
|
|
2216
2137
|
|
|
2217
2138
|
// expectations
|
|
2218
|
-
expect(props.
|
|
2219
|
-
|
|
2220
|
-
resourceDtoExpected,
|
|
2221
|
-
secretDtoExpected,
|
|
2222
|
-
);
|
|
2223
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2224
|
-
"The resource has been updated successfully",
|
|
2225
|
-
);
|
|
2226
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2139
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2140
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2227
2141
|
});
|
|
2228
2142
|
|
|
2229
2143
|
it("As a signed-in user I should be able to upgrade and save a resource v4 default to v5 default", async () => {
|
|
2230
|
-
expect.assertions(
|
|
2144
|
+
expect.assertions(2);
|
|
2231
2145
|
const props = defaultProps({
|
|
2232
2146
|
resource: defaultResourceDto({
|
|
2233
2147
|
metadata: defaultResourceMetadataDto({
|
|
@@ -2269,19 +2183,12 @@ describe("See the Create Resource", () => {
|
|
|
2269
2183
|
};
|
|
2270
2184
|
|
|
2271
2185
|
// expectations
|
|
2272
|
-
expect(props.
|
|
2273
|
-
|
|
2274
|
-
resourceDtoExpected,
|
|
2275
|
-
secretDtoExpected,
|
|
2276
|
-
);
|
|
2277
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2278
|
-
"The resource has been updated successfully",
|
|
2279
|
-
);
|
|
2280
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2186
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2187
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2281
2188
|
});
|
|
2282
2189
|
|
|
2283
2190
|
it("As a signed-in user I should be able to save a resource v4 default without changing secret, only resource type", async () => {
|
|
2284
|
-
expect.assertions(
|
|
2191
|
+
expect.assertions(2);
|
|
2285
2192
|
const props = defaultProps({
|
|
2286
2193
|
resource: defaultResourceDto({ resource_type_id: TEST_RESOURCE_TYPE_PASSWORD_STRING }),
|
|
2287
2194
|
});
|
|
@@ -2319,19 +2226,12 @@ describe("See the Create Resource", () => {
|
|
|
2319
2226
|
};
|
|
2320
2227
|
|
|
2321
2228
|
// expectations
|
|
2322
|
-
expect(props.
|
|
2323
|
-
|
|
2324
|
-
resourceDtoExpected,
|
|
2325
|
-
secretDtoExpected,
|
|
2326
|
-
);
|
|
2327
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2328
|
-
"The resource has been updated successfully",
|
|
2329
|
-
);
|
|
2330
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2229
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2230
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2331
2231
|
});
|
|
2332
2232
|
|
|
2333
2233
|
it("As a signed-in user I should be able to save a resource v4 totp after password and note deleted", async () => {
|
|
2334
|
-
expect.assertions(
|
|
2234
|
+
expect.assertions(2);
|
|
2335
2235
|
const props = defaultProps({
|
|
2336
2236
|
resource: defaultResourceDto({
|
|
2337
2237
|
metadata: defaultResourceMetadataDto({
|
|
@@ -2377,19 +2277,12 @@ describe("See the Create Resource", () => {
|
|
|
2377
2277
|
};
|
|
2378
2278
|
|
|
2379
2279
|
// expectations
|
|
2380
|
-
expect(props.
|
|
2381
|
-
|
|
2382
|
-
resourceDtoExpected,
|
|
2383
|
-
secretDtoExpected,
|
|
2384
|
-
);
|
|
2385
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2386
|
-
"The resource has been updated successfully",
|
|
2387
|
-
);
|
|
2388
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2280
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2281
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2389
2282
|
});
|
|
2390
2283
|
|
|
2391
2284
|
it("As a signed-in user I should be able to save a resource v4 password and note after standalone totp deleted", async () => {
|
|
2392
|
-
expect.assertions(
|
|
2285
|
+
expect.assertions(3);
|
|
2393
2286
|
const props = defaultProps({
|
|
2394
2287
|
resource: defaultResourceDto({
|
|
2395
2288
|
metadata: defaultResourceMetadataDto({ resource_type_id: TEST_RESOURCE_TYPE_TOTP, description: null }),
|
|
@@ -2439,15 +2332,8 @@ describe("See the Create Resource", () => {
|
|
|
2439
2332
|
};
|
|
2440
2333
|
|
|
2441
2334
|
// expectations
|
|
2442
|
-
expect(props.
|
|
2443
|
-
|
|
2444
|
-
resourceDtoExpected,
|
|
2445
|
-
secretDtoExpected,
|
|
2446
|
-
);
|
|
2447
|
-
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith(
|
|
2448
|
-
"The resource has been updated successfully",
|
|
2449
|
-
);
|
|
2450
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
2335
|
+
expect(props.onSubmit.mock.calls[0][0].toResourceDto()).toStrictEqual(resourceDtoExpected);
|
|
2336
|
+
expect(props.onSubmit.mock.calls[0][1]).toStrictEqual(secretDtoExpected);
|
|
2451
2337
|
});
|
|
2452
2338
|
|
|
2453
2339
|
it("As LU I should see an error dialog if the submit operation fails for an unexpected reason", async () => {
|
|
@@ -2462,7 +2348,7 @@ describe("See the Create Resource", () => {
|
|
|
2462
2348
|
await act(async () => (page = new EditResourcePage(props)));
|
|
2463
2349
|
|
|
2464
2350
|
const error = new PassboltApiFetchError("Jest simulate API error.");
|
|
2465
|
-
|
|
2351
|
+
props.onSubmit.mockImplementation(() => {
|
|
2466
2352
|
throw error;
|
|
2467
2353
|
});
|
|
2468
2354
|
jest.spyOn(props.dialogContext, "open").mockImplementationOnce(jest.fn);
|