@webex/webex-core 3.12.0-llmrefactor.1 → 3.12.0-llmrefactor.10
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/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/catalog-url.js +87 -0
- package/dist/interceptors/catalog-url.js.map +1 -0
- package/dist/interceptors/payload-transformer.js +25 -4
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +56 -1
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/services/service-catalog.js +102 -8
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +74 -44
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js +8 -1
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +76 -45
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +11 -3
- package/dist/webex-core.js.map +1 -1
- package/package.json +12 -12
- package/src/config.js +25 -0
- package/src/index.js +1 -0
- package/src/interceptors/catalog-url.js +66 -0
- package/src/interceptors/payload-transformer.js +23 -1
- package/src/lib/credentials/credentials.js +43 -0
- package/src/lib/services/service-catalog.js +106 -6
- package/src/lib/services/services.js +65 -30
- package/src/lib/services-v2/service-catalog.ts +10 -1
- package/src/lib/services-v2/services-v2.ts +70 -30
- package/src/webex-core.js +8 -0
- package/test/integration/spec/services/services.js +148 -113
- package/test/integration/spec/services-v2/services-v2.js +134 -99
- package/test/unit/spec/credentials/credentials.js +114 -1
- package/test/unit/spec/interceptors/catalog-url.js +224 -0
- package/test/unit/spec/interceptors/payload-transformer.js +119 -1
- package/test/unit/spec/services/service-catalog.js +275 -0
- package/test/unit/spec/services/services.js +135 -2
- package/test/unit/spec/services-v2/service-catalog.ts +41 -0
- package/test/unit/spec/services-v2/services-v2.ts +158 -2
- package/test/unit/spec/webex-core.js +77 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import '@webex/internal-plugin-device';
|
|
6
6
|
|
|
7
7
|
import {assert} from '@webex/test-helper-chai';
|
|
8
|
-
import {flaky} from '@webex/test-helper-mocha';
|
|
8
|
+
import {flaky, retryOn429} from '@webex/test-helper-mocha';
|
|
9
9
|
import WebexCore, {
|
|
10
10
|
ServiceCatalog,
|
|
11
11
|
ServiceRegistry,
|
|
@@ -443,7 +443,10 @@ describe('webex-core', () => {
|
|
|
443
443
|
// Before init settles, webex.ready must be false because services.ready
|
|
444
444
|
// is a dependency and starts false in the gated path.
|
|
445
445
|
assert.isFalse(gatedWebex.internal.services.ready, 'services.ready should start false');
|
|
446
|
-
assert.isFalse(
|
|
446
|
+
assert.isFalse(
|
|
447
|
+
gatedWebex.ready,
|
|
448
|
+
'webex.ready should not fire while services.ready is false'
|
|
449
|
+
);
|
|
447
450
|
|
|
448
451
|
// Wait up to 30s for services init to complete and flip ready.
|
|
449
452
|
await new Promise((resolve, reject) => {
|
|
@@ -463,7 +466,10 @@ describe('webex-core', () => {
|
|
|
463
466
|
});
|
|
464
467
|
});
|
|
465
468
|
|
|
466
|
-
assert.isTrue(
|
|
469
|
+
assert.isTrue(
|
|
470
|
+
gatedWebex.internal.services.ready,
|
|
471
|
+
'services.ready should flip true after init settles'
|
|
472
|
+
);
|
|
467
473
|
assert.isTrue(gatedWebex.ready, 'webex.ready should fire once services.ready flips');
|
|
468
474
|
});
|
|
469
475
|
});
|
|
@@ -903,18 +909,22 @@ describe('webex-core', () => {
|
|
|
903
909
|
}));
|
|
904
910
|
|
|
905
911
|
it('validates an authorized user and webex instance', () =>
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
912
|
+
retryOn429(() =>
|
|
913
|
+
services.validateUser({email: webexUser.email}).then((r) => {
|
|
914
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
915
|
+
assert.equal(r.activated, true);
|
|
916
|
+
assert.equal(r.exists, true);
|
|
917
|
+
})
|
|
918
|
+
));
|
|
911
919
|
|
|
912
920
|
it('validates an authorized EU user and webex instance', () =>
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
921
|
+
retryOn429(() =>
|
|
922
|
+
servicesEU.validateUser({email: webexUserEU.email}).then((r) => {
|
|
923
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
924
|
+
assert.equal(r.activated, true);
|
|
925
|
+
assert.equal(r.exists, true);
|
|
926
|
+
})
|
|
927
|
+
));
|
|
918
928
|
|
|
919
929
|
it("returns a rejected promise if the provided email isn't valid", () =>
|
|
920
930
|
unauthServices
|
|
@@ -927,131 +937,152 @@ describe('webex-core', () => {
|
|
|
927
937
|
}));
|
|
928
938
|
|
|
929
939
|
it('validates a non-existing user', () =>
|
|
930
|
-
|
|
931
|
-
.validateUser({email: createActivationEmail()})
|
|
932
|
-
.then((r) => {
|
|
940
|
+
retryOn429(() =>
|
|
941
|
+
unauthServices.validateUser({email: createActivationEmail()}).then((r) => {
|
|
933
942
|
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
934
943
|
assert.equal(r.activated, false);
|
|
935
944
|
assert.equal(r.exists, false);
|
|
936
945
|
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
937
946
|
assert.equal(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
938
947
|
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
939
|
-
})
|
|
948
|
+
})
|
|
949
|
+
));
|
|
940
950
|
|
|
941
951
|
it('validates new user with activationOptions suppressEmail false', () =>
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
952
|
+
retryOn429(() =>
|
|
953
|
+
unauthServices
|
|
954
|
+
.validateUser({
|
|
955
|
+
email: createActivationEmail(),
|
|
956
|
+
activationOptions: {suppressEmail: false},
|
|
957
|
+
})
|
|
958
|
+
.then((r) => {
|
|
959
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
960
|
+
assert.equal(r.activated, false);
|
|
961
|
+
assert.equal(r.exists, false);
|
|
962
|
+
assert.equal(r.user.verificationEmailTriggered, true);
|
|
963
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
964
|
+
assert.equal(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
965
|
+
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
966
|
+
})
|
|
967
|
+
));
|
|
956
968
|
|
|
957
969
|
it('validates new user with activationOptions suppressEmail true', () =>
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
970
|
+
retryOn429(() =>
|
|
971
|
+
unauthServices
|
|
972
|
+
.validateUser({
|
|
973
|
+
email: createActivationEmail(),
|
|
974
|
+
activationOptions: {suppressEmail: true},
|
|
975
|
+
})
|
|
976
|
+
.then((r) => {
|
|
977
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
978
|
+
assert.equal(r.activated, false);
|
|
979
|
+
assert.equal(r.exists, false);
|
|
980
|
+
assert.equal(r.user.verificationEmailTriggered, false);
|
|
981
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
982
|
+
assert.equal(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
983
|
+
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
984
|
+
})
|
|
985
|
+
));
|
|
972
986
|
|
|
973
987
|
it('validates an inactive user', () => {
|
|
974
988
|
const inactive = 'webex.web.client+nonactivated@gmail.com';
|
|
975
989
|
|
|
976
|
-
return
|
|
977
|
-
|
|
978
|
-
|
|
990
|
+
return retryOn429(() =>
|
|
991
|
+
unauthServices
|
|
992
|
+
.validateUser({email: inactive, activationOptions: {suppressEmail: true}})
|
|
993
|
+
.then((r) => {
|
|
994
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
995
|
+
assert.equal(r.activated, false, 'activated');
|
|
996
|
+
assert.equal(r.exists, true, 'exists');
|
|
997
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
998
|
+
assert.equal(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
999
|
+
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
1000
|
+
})
|
|
1001
|
+
).catch(() => {
|
|
1002
|
+
assert(true);
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
it('validates an existing user', () =>
|
|
1007
|
+
retryOn429(() =>
|
|
1008
|
+
unauthServices.validateUser({email: webexUser.email}).then((r) => {
|
|
979
1009
|
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
980
|
-
assert.equal(r.activated,
|
|
981
|
-
assert.equal(r.exists, true
|
|
1010
|
+
assert.equal(r.activated, true);
|
|
1011
|
+
assert.equal(r.exists, true);
|
|
982
1012
|
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
983
|
-
assert.
|
|
1013
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
984
1014
|
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
985
1015
|
})
|
|
986
|
-
|
|
987
|
-
assert(true);
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
|
|
991
|
-
it('validates an existing user', () =>
|
|
992
|
-
unauthServices.validateUser({email: webexUser.email}).then((r) => {
|
|
993
|
-
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
994
|
-
assert.equal(r.activated, true);
|
|
995
|
-
assert.equal(r.exists, true);
|
|
996
|
-
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
997
|
-
assert.isAbove(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
998
|
-
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
999
|
-
}));
|
|
1016
|
+
));
|
|
1000
1017
|
|
|
1001
1018
|
it('validates an existing EU user', () =>
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1019
|
+
retryOn429(() =>
|
|
1020
|
+
unauthServices.validateUser({email: webexUserEU.email}).then((r) => {
|
|
1021
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
1022
|
+
assert.equal(r.activated, true);
|
|
1023
|
+
assert.equal(r.exists, true);
|
|
1024
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'preauth')).length, 0);
|
|
1025
|
+
assert.isAbove(Object.keys(unauthServices.list(false, 'signin')).length, 0);
|
|
1026
|
+
assert.equal(Object.keys(unauthServices.list(false, 'postauth')).length, 0);
|
|
1027
|
+
})
|
|
1028
|
+
));
|
|
1010
1029
|
|
|
1011
1030
|
it('sends the prelogin user id as undefined when not specified', () => {
|
|
1012
1031
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
1013
1032
|
|
|
1014
|
-
return
|
|
1015
|
-
.
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1033
|
+
return retryOn429(() => {
|
|
1034
|
+
requestStub.resetHistory();
|
|
1035
|
+
|
|
1036
|
+
return unauthServices
|
|
1037
|
+
.validateUser({
|
|
1038
|
+
email: createActivationEmail(),
|
|
1039
|
+
activationOptions: {suppressEmail: true},
|
|
1040
|
+
})
|
|
1041
|
+
.then(() => {
|
|
1042
|
+
assert.isUndefined(getActivationRequest(requestStub).headers['x-prelogin-userid']);
|
|
1043
|
+
});
|
|
1044
|
+
});
|
|
1022
1045
|
});
|
|
1023
1046
|
|
|
1024
1047
|
it('sends the prelogin user id as provided when specified', () => {
|
|
1025
1048
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
1026
1049
|
const preloginUserId = uuid.v4();
|
|
1027
1050
|
|
|
1028
|
-
return
|
|
1029
|
-
.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1051
|
+
return retryOn429(() => {
|
|
1052
|
+
requestStub.resetHistory();
|
|
1053
|
+
|
|
1054
|
+
return unauthServices
|
|
1055
|
+
.validateUser({
|
|
1056
|
+
email: createActivationEmail(),
|
|
1057
|
+
activationOptions: {suppressEmail: true},
|
|
1058
|
+
preloginUserId,
|
|
1059
|
+
})
|
|
1060
|
+
.then(() => {
|
|
1061
|
+
assert.strictEqual(
|
|
1062
|
+
getActivationRequest(requestStub).headers['x-prelogin-userid'],
|
|
1063
|
+
preloginUserId
|
|
1064
|
+
);
|
|
1065
|
+
});
|
|
1066
|
+
});
|
|
1040
1067
|
});
|
|
1041
1068
|
|
|
1042
1069
|
it('uses the license service by default', () => {
|
|
1043
1070
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
1044
1071
|
|
|
1045
|
-
return
|
|
1046
|
-
.
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1072
|
+
return retryOn429(() => {
|
|
1073
|
+
requestStub.resetHistory();
|
|
1074
|
+
|
|
1075
|
+
return unauthServices
|
|
1076
|
+
.validateUser({
|
|
1077
|
+
email: createActivationEmail(),
|
|
1078
|
+
activationOptions: {suppressEmail: true},
|
|
1079
|
+
})
|
|
1080
|
+
.then(() => {
|
|
1081
|
+
const request = getActivationRequest(requestStub, false);
|
|
1082
|
+
assert.strictEqual(request.service, 'license');
|
|
1083
|
+
assert.strictEqual(request.resource, 'users/activations');
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1055
1086
|
});
|
|
1056
1087
|
|
|
1057
1088
|
it('uses the user-onboarding service when useUserOnboardingServiceForActivations config is true', () => {
|
|
@@ -1065,16 +1096,20 @@ describe('webex-core', () => {
|
|
|
1065
1096
|
const userOnboardingServices = userOnboardingWebex.internal.services;
|
|
1066
1097
|
const requestStub = sandbox.spy(userOnboardingServices, 'request');
|
|
1067
1098
|
|
|
1068
|
-
return
|
|
1069
|
-
.
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1099
|
+
return retryOn429(() => {
|
|
1100
|
+
requestStub.resetHistory();
|
|
1101
|
+
|
|
1102
|
+
return userOnboardingServices
|
|
1103
|
+
.validateUser({
|
|
1104
|
+
email: createActivationEmail(),
|
|
1105
|
+
activationOptions: {suppressEmail: true},
|
|
1106
|
+
})
|
|
1107
|
+
.then(() => {
|
|
1108
|
+
const request = getActivationRequest(requestStub, true);
|
|
1109
|
+
assert.strictEqual(request.service, 'user-onboarding');
|
|
1110
|
+
assert.strictEqual(request.resource, 'api/v1/users/activations');
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1078
1113
|
});
|
|
1079
1114
|
});
|
|
1080
1115
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import '@webex/internal-plugin-device';
|
|
6
6
|
|
|
7
7
|
import {assert} from '@webex/test-helper-chai';
|
|
8
|
-
import {flaky} from '@webex/test-helper-mocha';
|
|
8
|
+
import {flaky, retryOn429} from '@webex/test-helper-mocha';
|
|
9
9
|
import WebexCore, {
|
|
10
10
|
ServiceCatalogV2,
|
|
11
11
|
ServiceDetail,
|
|
@@ -354,7 +354,10 @@ describe('webex-core', () => {
|
|
|
354
354
|
// Before init settles, webex.ready must be false because services.ready
|
|
355
355
|
// is a dependency and starts false in the gated path.
|
|
356
356
|
assert.isFalse(gatedWebex.internal.services.ready, 'services.ready should start false');
|
|
357
|
-
assert.isFalse(
|
|
357
|
+
assert.isFalse(
|
|
358
|
+
gatedWebex.ready,
|
|
359
|
+
'webex.ready should not fire while services.ready is false'
|
|
360
|
+
);
|
|
358
361
|
|
|
359
362
|
// Wait up to 30s for services init to complete and flip ready.
|
|
360
363
|
await new Promise((resolve, reject) => {
|
|
@@ -374,7 +377,10 @@ describe('webex-core', () => {
|
|
|
374
377
|
});
|
|
375
378
|
});
|
|
376
379
|
|
|
377
|
-
assert.isTrue(
|
|
380
|
+
assert.isTrue(
|
|
381
|
+
gatedWebex.internal.services.ready,
|
|
382
|
+
'services.ready should flip true after init settles'
|
|
383
|
+
);
|
|
378
384
|
assert.isTrue(gatedWebex.ready, 'webex.ready should fire once services.ready flips');
|
|
379
385
|
});
|
|
380
386
|
});
|
|
@@ -826,18 +832,22 @@ describe('webex-core', () => {
|
|
|
826
832
|
}));
|
|
827
833
|
|
|
828
834
|
it('validates an authorized user and webex instance', () =>
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
835
|
+
retryOn429(() =>
|
|
836
|
+
services.validateUser({email: webexUser.email}).then((r) => {
|
|
837
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
838
|
+
assert.equal(r.activated, true);
|
|
839
|
+
assert.equal(r.exists, true);
|
|
840
|
+
})
|
|
841
|
+
));
|
|
834
842
|
|
|
835
843
|
it('validates an authorized EU user and webex instance', () =>
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
844
|
+
retryOn429(() =>
|
|
845
|
+
servicesEU.validateUser({email: webexUserEU.email}).then((r) => {
|
|
846
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
847
|
+
assert.equal(r.activated, true);
|
|
848
|
+
assert.equal(r.exists, true);
|
|
849
|
+
})
|
|
850
|
+
));
|
|
841
851
|
|
|
842
852
|
it("returns a rejected promise if the provided email isn't valid", () =>
|
|
843
853
|
unauthServices
|
|
@@ -850,113 +860,134 @@ describe('webex-core', () => {
|
|
|
850
860
|
}));
|
|
851
861
|
|
|
852
862
|
it('validates a non-existing user', () =>
|
|
853
|
-
|
|
854
|
-
.validateUser({email: createActivationEmail()})
|
|
855
|
-
.then((r) => {
|
|
863
|
+
retryOn429(() =>
|
|
864
|
+
unauthServices.validateUser({email: createActivationEmail()}).then((r) => {
|
|
856
865
|
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
857
866
|
assert.equal(r.activated, false);
|
|
858
867
|
assert.equal(r.exists, false);
|
|
859
|
-
})
|
|
868
|
+
})
|
|
869
|
+
));
|
|
860
870
|
|
|
861
871
|
it('validates new user with activationOptions suppressEmail false', () =>
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
872
|
+
retryOn429(() =>
|
|
873
|
+
unauthServices
|
|
874
|
+
.validateUser({
|
|
875
|
+
email: createActivationEmail(),
|
|
876
|
+
activationOptions: {suppressEmail: false},
|
|
877
|
+
})
|
|
878
|
+
.then((r) => {
|
|
879
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
880
|
+
assert.equal(r.activated, false);
|
|
881
|
+
assert.equal(r.exists, false);
|
|
882
|
+
assert.equal(r.user.verificationEmailTriggered, true);
|
|
883
|
+
})
|
|
884
|
+
));
|
|
873
885
|
|
|
874
886
|
it('validates new user with activationOptions suppressEmail true', () =>
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
887
|
+
retryOn429(() =>
|
|
888
|
+
unauthServices
|
|
889
|
+
.validateUser({
|
|
890
|
+
email: createActivationEmail(),
|
|
891
|
+
activationOptions: {suppressEmail: true},
|
|
892
|
+
})
|
|
893
|
+
.then((r) => {
|
|
894
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
895
|
+
assert.equal(r.activated, false);
|
|
896
|
+
assert.equal(r.exists, false);
|
|
897
|
+
assert.equal(r.user.verificationEmailTriggered, false);
|
|
898
|
+
})
|
|
899
|
+
));
|
|
886
900
|
|
|
887
901
|
it('validates an inactive user', () => {
|
|
888
902
|
const inactive = 'webex.web.client+nonactivated@gmail.com';
|
|
889
903
|
|
|
890
|
-
return
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
904
|
+
return retryOn429(() =>
|
|
905
|
+
unauthServices
|
|
906
|
+
.validateUser({email: inactive, activationOptions: {suppressEmail: true}})
|
|
907
|
+
.then((r) => {
|
|
908
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
909
|
+
assert.equal(r.activated, false, 'activated');
|
|
910
|
+
assert.equal(r.exists, true, 'exists');
|
|
911
|
+
})
|
|
912
|
+
).catch(() => {
|
|
913
|
+
assert(true);
|
|
914
|
+
});
|
|
900
915
|
});
|
|
901
916
|
|
|
902
917
|
it('validates an existing user', () =>
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
918
|
+
retryOn429(() =>
|
|
919
|
+
unauthServices.validateUser({email: webexUser.email}).then((r) => {
|
|
920
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
921
|
+
assert.equal(r.activated, true);
|
|
922
|
+
assert.equal(r.exists, true);
|
|
923
|
+
})
|
|
924
|
+
));
|
|
908
925
|
|
|
909
926
|
it('validates an existing EU user', () =>
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
927
|
+
retryOn429(() =>
|
|
928
|
+
unauthServices.validateUser({email: webexUserEU.email}).then((r) => {
|
|
929
|
+
assert.hasAllKeys(r, ['activated', 'exists', 'user', 'details']);
|
|
930
|
+
assert.equal(r.activated, true);
|
|
931
|
+
assert.equal(r.exists, true);
|
|
932
|
+
})
|
|
933
|
+
));
|
|
915
934
|
|
|
916
935
|
it('sends the prelogin user id as undefined when not specified', () => {
|
|
917
936
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
918
937
|
|
|
919
|
-
return
|
|
920
|
-
.
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
938
|
+
return retryOn429(() => {
|
|
939
|
+
requestStub.resetHistory();
|
|
940
|
+
|
|
941
|
+
return unauthServices
|
|
942
|
+
.validateUser({
|
|
943
|
+
email: createActivationEmail(),
|
|
944
|
+
activationOptions: {suppressEmail: true},
|
|
945
|
+
})
|
|
946
|
+
.then(() => {
|
|
947
|
+
assert.isUndefined(getActivationRequest(requestStub).headers['x-prelogin-userid']);
|
|
948
|
+
});
|
|
949
|
+
});
|
|
927
950
|
});
|
|
928
951
|
|
|
929
952
|
it('sends the prelogin user id as provided when specified', () => {
|
|
930
953
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
931
954
|
const preloginUserId = uuid.v4();
|
|
932
955
|
|
|
933
|
-
return
|
|
934
|
-
.
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
956
|
+
return retryOn429(() => {
|
|
957
|
+
requestStub.resetHistory();
|
|
958
|
+
|
|
959
|
+
return unauthServices
|
|
960
|
+
.validateUser({
|
|
961
|
+
email: createActivationEmail(),
|
|
962
|
+
activationOptions: {suppressEmail: true},
|
|
963
|
+
preloginUserId,
|
|
964
|
+
})
|
|
965
|
+
.then(() => {
|
|
966
|
+
assert.strictEqual(
|
|
967
|
+
getActivationRequest(requestStub).headers['x-prelogin-userid'],
|
|
968
|
+
preloginUserId
|
|
969
|
+
);
|
|
970
|
+
});
|
|
971
|
+
});
|
|
945
972
|
});
|
|
946
973
|
|
|
947
974
|
it('uses the license service by default', () => {
|
|
948
975
|
const requestStub = sandbox.spy(unauthServices, 'request');
|
|
949
976
|
|
|
950
|
-
return
|
|
951
|
-
.
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
977
|
+
return retryOn429(() => {
|
|
978
|
+
requestStub.resetHistory();
|
|
979
|
+
|
|
980
|
+
return unauthServices
|
|
981
|
+
.validateUser({
|
|
982
|
+
email: createActivationEmail(),
|
|
983
|
+
activationOptions: {suppressEmail: true},
|
|
984
|
+
})
|
|
985
|
+
.then(() => {
|
|
986
|
+
const request = getActivationRequest(requestStub, false);
|
|
987
|
+
assert.strictEqual(request.service, 'license');
|
|
988
|
+
assert.strictEqual(request.resource, 'users/activations');
|
|
989
|
+
});
|
|
990
|
+
});
|
|
960
991
|
});
|
|
961
992
|
|
|
962
993
|
it('uses the user-onboarding service when useUserOnboardingServiceForActivations config is true', () => {
|
|
@@ -970,16 +1001,20 @@ describe('webex-core', () => {
|
|
|
970
1001
|
const userOnboardingServices = userOnboardingWebex.internal.services;
|
|
971
1002
|
const requestStub = sandbox.spy(userOnboardingServices, 'request');
|
|
972
1003
|
|
|
973
|
-
return
|
|
974
|
-
.
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1004
|
+
return retryOn429(() => {
|
|
1005
|
+
requestStub.resetHistory();
|
|
1006
|
+
|
|
1007
|
+
return userOnboardingServices
|
|
1008
|
+
.validateUser({
|
|
1009
|
+
email: createActivationEmail(),
|
|
1010
|
+
activationOptions: {suppressEmail: true},
|
|
1011
|
+
})
|
|
1012
|
+
.then(() => {
|
|
1013
|
+
const request = getActivationRequest(requestStub, true);
|
|
1014
|
+
assert.strictEqual(request.service, 'user-onboarding');
|
|
1015
|
+
assert.strictEqual(request.resource, 'api/v1/users/activations');
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
983
1018
|
});
|
|
984
1019
|
});
|
|
985
1020
|
|