@webex/test-users 3.0.0-beta.26 → 3.0.0-beta.28
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/whistler.js +4 -2
- package/dist/whistler.js.map +1 -1
- package/package.json +4 -4
- package/src/whistler.js +6 -2
package/dist/whistler.js
CHANGED
|
@@ -15,6 +15,8 @@ exports.removeTestUser = removeTestUser;
|
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
16
16
|
var _btoa = _interopRequireDefault(require("btoa"));
|
|
17
17
|
var _httpCore = require("@webex/http-core");
|
|
18
|
+
var _nodeRandomName = _interopRequireDefault(require("node-random-name"));
|
|
19
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
18
20
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
22
|
/**
|
|
@@ -102,8 +104,8 @@ function createTestUser() {
|
|
|
102
104
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
103
105
|
var clientId = options.clientId || process.env.WEBEX_CLIENT_ID;
|
|
104
106
|
var clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;
|
|
105
|
-
var machineAccount = options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT;
|
|
106
|
-
var machinePassword = options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD;
|
|
107
|
+
var machineAccount = options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT || (0, _nodeRandomName.default)();
|
|
108
|
+
var machinePassword = options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD || "".concat(_uuid.default.v4(), "zAY1*");
|
|
107
109
|
var idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;
|
|
108
110
|
var orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;
|
|
109
111
|
var whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;
|
package/dist/whistler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getClientCredentials","clientId","clientSecret","orgId","idbrokerUrl","machineAccount","machinePassword","request","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","btoa","token_type","access_token","createTestUser","options","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","WHISTLER_MACHINE_ACCOUNT","WHISTLER_MACHINE_PASSWORD","IDBROKER_BASE_URL","WHISTLER_TEST_ORG_ID","whistlerServiceUrl","WHISTLER_API_SERVICE_URL","reservationGroup","userScopes","Error","qs","isAccessTokenRequired","responseMetaData","ciPassword","emailAddress","name","displayName","webExUserName","token","ciAccessToken","reservationUrl","removeTestUser"],"sources":["whistler.js"],"sourcesContent":["import btoa from 'btoa';\nimport {request} from '@webex/http-core';\n\n/**\n * Fetches credentials/access_token to talk to the whistler endpoint\n *\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @param {string} options.orgId\n * @param {string} options.machineAccount\n * @param {string} options.machinePassword\n * @private\n * @returns {Promise<string>}\n */\nconst getClientCredentials = ({\n clientId,\n clientSecret,\n orgId,\n idbrokerUrl,\n machineAccount,\n machinePassword,\n}) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/token/${orgId}/v2/actions/GetBearerToken/invoke`,\n json: true,\n body: {\n uid: machineAccount,\n password: machinePassword,\n },\n })\n .then((res) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n assertion: res.body.BearerToken,\n grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',\n scope: 'webexsquare:get_conversation webexsquare:admin',\n self_contained_token: true,\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n // authorization: `Basic + ${btoa(`${clientId}:${clientSecret}`)}`\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n )\n .then((res) => `${res.body.token_type} ${res.body.access_token}`);\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} token\n * @property {string} reservationUrl\n * @property {object} responseMetaData - whistler given properties\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @param {Object} [options]\n * @param {string} [whistlerServiceUrl] defaults to WHISTLER_API_SERVICE_URL\n * @param {string} [options.clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [options.clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [options.idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @param {string} [options.orgId] organization ID to create the user under\n * @param {string} [options.machineAccount] defaults to WHISTLER_MACHINE_ACCOUNT\n * @param {string} [options.machinePassword] defaults to WHISTLER_MACHINE_PASSWORD\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport default function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const machineAccount = options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT;\n const machinePassword = options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;\n const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;\n const {reservationGroup, userScopes} = options;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!machineAccount) {\n throw new Error(\n 'options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined'\n );\n }\n\n if (!machinePassword) {\n throw new Error(\n 'options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined'\n );\n }\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!orgId) {\n throw new Error('options.orgId or process.env.WHISTLER_TEST_ORG_ID must be defined');\n }\n\n if (!whistlerServiceUrl) {\n throw new Error(\n 'options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined'\n );\n }\n\n // For reservation groups and user scopes\n // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser\n return getClientCredentials({\n clientId,\n clientSecret,\n machineAccount,\n machinePassword,\n idbrokerUrl,\n orgId,\n })\n .then((authorization) =>\n request({\n method: 'GET',\n uri: `${whistlerServiceUrl}/reservations/testUser`,\n qs: {\n reservationGroup,\n userScopes,\n isAccessTokenRequired: true,\n },\n headers: {\n authorization,\n },\n })\n )\n .then((res) => ({\n password: res.body.responseMetaData.ciPassword,\n emailAddress: res.body.responseMetaData.name,\n displayName: res.body.responseMetaData.webExUserName,\n token: res.body.responseMetaData.ciAccessToken,\n reservationUrl: res.body.reservationUrl,\n ...res.body.responseMetaData,\n }));\n}\n\n/**\n *\n * @param {Object} options\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n return request({\n method: 'DELETE',\n headers: {\n authorization: `Bearer ${options.token}`,\n },\n uri: options.reservationUrl,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAAyC;AAAA;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoB;EAAA,IACxBC,QAAQ,QAARA,QAAQ;IACRC,YAAY,QAAZA,YAAY;IACZC,KAAK,QAALA,KAAK;IACLC,WAAW,QAAXA,WAAW;IACXC,cAAc,QAAdA,cAAc;IACdC,eAAe,QAAfA,eAAe;EAAA,OAEf,IAAAC,iBAAO,EAAC;IACNC,MAAM,EAAE,MAAM;IACdC,GAAG,YAAKL,WAAW,wBAAcD,KAAK,sCAAmC;IACzEO,IAAI,EAAE,IAAI;IACVC,IAAI,EAAE;MACJC,GAAG,EAAEP,cAAc;MACnBQ,QAAQ,EAAEP;IACZ;EACF,CAAC,CAAC,CACCQ,IAAI,CAAC,UAACC,GAAG;IAAA,OACR,IAAAR,iBAAO,EAAC;MACNC,MAAM,EAAE,MAAM;MACdC,GAAG,YAAKL,WAAW,gCAA6B;MAChDM,IAAI,EAAE,IAAI;MACVM,IAAI,EAAE;QACJC,SAAS,EAAEF,GAAG,CAACJ,IAAI,CAACO,WAAW;QAC/BC,UAAU,EAAE,+CAA+C;QAC3DC,KAAK,EAAE,gDAAgD;QACvDC,oBAAoB,EAAE,IAAI;QAC1BC,SAAS,EAAErB,QAAQ;QACnBsB,aAAa,EAAErB;MACjB,CAAC;MACDsB,OAAO,EAAE;QACP;QACA;QACA;QACA;QACAC,aAAa,EAAE,IAAAC,aAAI,YAAIzB,QAAQ,cAAIC,YAAY;MACjD;IACF,CAAC,CAAC;EAAA,EACH,CACAY,IAAI,CAAC,UAACC,GAAG;IAAA,iB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CAAC2C;IAAc,GACpCvC,GAAG,CAACJ,IAAI,CAACmC,gBAAgB;EAAA,CAC5B,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASS,cAAc,GAAe;EAAA,IAAdzB,OAAO,uEAAG,CAAC,CAAC;EACzC,OAAO,IAAAvB,iBAAO,EAAC;IACbC,MAAM,EAAE,QAAQ;IAChBgB,OAAO,EAAE;MACPC,aAAa,mBAAYK,OAAO,CAACsB,KAAK;IACxC,CAAC;IACD3C,GAAG,EAAEqB,OAAO,CAACwB;EACf,CAAC,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["getClientCredentials","clientId","clientSecret","orgId","idbrokerUrl","machineAccount","machinePassword","request","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","btoa","token_type","access_token","createTestUser","options","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","WHISTLER_MACHINE_ACCOUNT","randomName","WHISTLER_MACHINE_PASSWORD","uuid","v4","IDBROKER_BASE_URL","WHISTLER_TEST_ORG_ID","whistlerServiceUrl","WHISTLER_API_SERVICE_URL","reservationGroup","userScopes","Error","qs","isAccessTokenRequired","responseMetaData","ciPassword","emailAddress","name","displayName","webExUserName","token","ciAccessToken","reservationUrl","removeTestUser"],"sources":["whistler.js"],"sourcesContent":["import btoa from 'btoa';\nimport {request} from '@webex/http-core';\nimport randomName from 'node-random-name';\nimport uuid from 'uuid';\n\n/**\n * Fetches credentials/access_token to talk to the whistler endpoint\n *\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @param {string} options.orgId\n * @param {string} options.machineAccount\n * @param {string} options.machinePassword\n * @private\n * @returns {Promise<string>}\n */\nconst getClientCredentials = ({\n clientId,\n clientSecret,\n orgId,\n idbrokerUrl,\n machineAccount,\n machinePassword,\n}) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/token/${orgId}/v2/actions/GetBearerToken/invoke`,\n json: true,\n body: {\n uid: machineAccount,\n password: machinePassword,\n },\n })\n .then((res) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n assertion: res.body.BearerToken,\n grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',\n scope: 'webexsquare:get_conversation webexsquare:admin',\n self_contained_token: true,\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n // authorization: `Basic + ${btoa(`${clientId}:${clientSecret}`)}`\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n )\n .then((res) => `${res.body.token_type} ${res.body.access_token}`);\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} token\n * @property {string} reservationUrl\n * @property {object} responseMetaData - whistler given properties\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @param {Object} [options]\n * @param {string} [whistlerServiceUrl] defaults to WHISTLER_API_SERVICE_URL\n * @param {string} [options.clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [options.clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [options.idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @param {string} [options.orgId] organization ID to create the user under\n * @param {string} [options.machineAccount] defaults to WHISTLER_MACHINE_ACCOUNT\n * @param {string} [options.machinePassword] defaults to WHISTLER_MACHINE_PASSWORD\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport default function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const machineAccount =\n options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT || randomName();\n const machinePassword =\n options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD || `${uuid.v4()}zAY1*`;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;\n const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;\n const {reservationGroup, userScopes} = options;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!machineAccount) {\n throw new Error(\n 'options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined'\n );\n }\n\n if (!machinePassword) {\n throw new Error(\n 'options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined'\n );\n }\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!orgId) {\n throw new Error('options.orgId or process.env.WHISTLER_TEST_ORG_ID must be defined');\n }\n\n if (!whistlerServiceUrl) {\n throw new Error(\n 'options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined'\n );\n }\n\n // For reservation groups and user scopes\n // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser\n return getClientCredentials({\n clientId,\n clientSecret,\n machineAccount,\n machinePassword,\n idbrokerUrl,\n orgId,\n })\n .then((authorization) =>\n request({\n method: 'GET',\n uri: `${whistlerServiceUrl}/reservations/testUser`,\n qs: {\n reservationGroup,\n userScopes,\n isAccessTokenRequired: true,\n },\n headers: {\n authorization,\n },\n })\n )\n .then((res) => ({\n password: res.body.responseMetaData.ciPassword,\n emailAddress: res.body.responseMetaData.name,\n displayName: res.body.responseMetaData.webExUserName,\n token: res.body.responseMetaData.ciAccessToken,\n reservationUrl: res.body.reservationUrl,\n ...res.body.responseMetaData,\n }));\n}\n\n/**\n *\n * @param {Object} options\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n return request({\n method: 'DELETE',\n headers: {\n authorization: `Bearer ${options.token}`,\n },\n uri: options.reservationUrl,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAAwB;AAAA;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoB;EAAA,IACxBC,QAAQ,QAARA,QAAQ;IACRC,YAAY,QAAZA,YAAY;IACZC,KAAK,QAALA,KAAK;IACLC,WAAW,QAAXA,WAAW;IACXC,cAAc,QAAdA,cAAc;IACdC,eAAe,QAAfA,eAAe;EAAA,OAEf,IAAAC,iBAAO,EAAC;IACNC,MAAM,EAAE,MAAM;IACdC,GAAG,YAAKL,WAAW,wBAAcD,KAAK,sCAAmC;IACzEO,IAAI,EAAE,IAAI;IACVC,IAAI,EAAE;MACJC,GAAG,EAAEP,cAAc;MACnBQ,QAAQ,EAAEP;IACZ;EACF,CAAC,CAAC,CACCQ,IAAI,CAAC,UAACC,GAAG;IAAA,OACR,IAAAR,iBAAO,EAAC;MACNC,MAAM,EAAE,MAAM;MACdC,GAAG,YAAKL,WAAW,gCAA6B;MAChDM,IAAI,EAAE,IAAI;MACVM,IAAI,EAAE;QACJC,SAAS,EAAEF,GAAG,CAACJ,IAAI,CAACO,WAAW;QAC/BC,UAAU,EAAE,+CAA+C;QAC3DC,KAAK,EAAE,gDAAgD;QACvDC,oBAAoB,EAAE,IAAI;QAC1BC,SAAS,EAAErB,QAAQ;QACnBsB,aAAa,EAAErB;MACjB,CAAC;MACDsB,OAAO,EAAE;QACP;QACA;QACA;QACA;QACAC,aAAa,EAAE,IAAAC,aAAI,YAAIzB,QAAQ,cAAIC,YAAY;MACjD;IACF,CAAC,CAAC;EAAA,EACH,CACAY,IAAI,CAAC,UAACC,GAAG;IAAA,iBAAQA,GAAG,CAACJ,IAAI,CA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C9CC,cAAc,EAAE1C,GAAG,CAACJ,IAAI,CAAC8C;IAAc,GACpC1C,GAAG,CAACJ,IAAI,CAACsC,gBAAgB;EAAA,CAC5B,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASS,cAAc,GAAe;EAAA,IAAd5B,OAAO,uEAAG,CAAC,CAAC;EACzC,OAAO,IAAAvB,iBAAO,EAAC;IACbC,MAAM,EAAE,QAAQ;IAChBgB,OAAO,EAAE;MACPC,aAAa,mBAAYK,OAAO,CAACyB,KAAK;IACxC,CAAC;IACD9C,GAAG,EAAEqB,OAAO,CAAC2B;EACf,CAAC,CAAC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/test-users",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.28",
|
|
4
4
|
"description": "Cisco Webex Test Users",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"chai-as-promised": "^7.1.1"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@webex/http-core": "3.0.0-beta.
|
|
28
|
-
"@webex/test-helper-mocha": "3.0.0-beta.
|
|
29
|
-
"@webex/test-users": "3.0.0-beta.
|
|
27
|
+
"@webex/http-core": "3.0.0-beta.28",
|
|
28
|
+
"@webex/test-helper-mocha": "3.0.0-beta.28",
|
|
29
|
+
"@webex/test-users": "3.0.0-beta.28",
|
|
30
30
|
"btoa": "^1.2.1",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"node-random-name": "^1.0.1",
|
package/src/whistler.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import btoa from 'btoa';
|
|
2
2
|
import {request} from '@webex/http-core';
|
|
3
|
+
import randomName from 'node-random-name';
|
|
4
|
+
import uuid from 'uuid';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Fetches credentials/access_token to talk to the whistler endpoint
|
|
@@ -85,8 +87,10 @@ const getClientCredentials = ({
|
|
|
85
87
|
export default function createTestUser(options = {}) {
|
|
86
88
|
const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;
|
|
87
89
|
const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;
|
|
88
|
-
const machineAccount =
|
|
89
|
-
|
|
90
|
+
const machineAccount =
|
|
91
|
+
options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT || randomName();
|
|
92
|
+
const machinePassword =
|
|
93
|
+
options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD || `${uuid.v4()}zAY1*`;
|
|
90
94
|
const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;
|
|
91
95
|
const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;
|
|
92
96
|
const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;
|