mirror of
https://github.com/Netflix/dial-reference.git
synced 2026-06-08 10:59:59 +00:00
Add to and improve upon the DIAL server unit tests.
This commit is contained in:
@@ -142,6 +142,40 @@ function launchApplication(host, app, payload) {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* send HTTP request to the host.
|
||||
*
|
||||
* @param {String} host IP address of host on which DIAL server
|
||||
* @param {String} method HTTP method.
|
||||
* @param {Object} headers HTTP headers, passed as {"Header": Value}
|
||||
* @param {String} urlSuffix appended to the URL
|
||||
* @param {String} body HTTP body
|
||||
*/
|
||||
function sendRequest(host, method, headers, urlSuffix, body) {
|
||||
urlSuffix = urlSuffix || "";
|
||||
|
||||
return new Q()
|
||||
.then(getAppsUrl.bind(null, host))
|
||||
.then(function (appUrl) {
|
||||
var request = {
|
||||
url: encodeURI(appUrl + urlSuffix),
|
||||
method: method,
|
||||
timeout: 6000,
|
||||
headers: headers
|
||||
};
|
||||
request.body = body;
|
||||
return new Q.Promise(function (resolve, reject) {
|
||||
return httpRequest(request, function handleResponse(error, response) {
|
||||
if(error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function sleepSystem(host, key) {
|
||||
var keyComponent = key ? `&key=${key}` : '';
|
||||
return getAppsUrl(host)
|
||||
@@ -279,7 +313,7 @@ function constructAppResourceUrl(host, appName) {
|
||||
return new Q()
|
||||
.then(getAppsUrl.bind(null, host))
|
||||
.then(function (appUrl) {
|
||||
return appUrl.replace(/\/+$/, `/${appName}`);
|
||||
return appUrl.replace(/\/*$/, `/${appName}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -423,4 +457,5 @@ module.exports.hideApplicationInstance = hideApplicationInstance;
|
||||
module.exports.constructAppResourceUrl = constructAppResourceUrl;
|
||||
module.exports.getAppsUrl = getAppsUrl;
|
||||
module.exports.getLocation = getLocation;
|
||||
module.exports.sleepSystem = sleepSystem;
|
||||
module.exports.sleepSystem = sleepSystem;
|
||||
module.exports.sendRequest = sendRequest;
|
||||
|
||||
248
server/tests/js_tests/package-lock.json
generated
248
server/tests/js_tests/package-lock.json
generated
@@ -9,10 +9,10 @@
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
|
||||
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
|
||||
"requires": {
|
||||
"co": "4.6.0",
|
||||
"fast-deep-equal": "1.1.0",
|
||||
"fast-json-stable-stringify": "2.0.0",
|
||||
"json-schema-traverse": "0.3.1"
|
||||
"co": "^4.6.0",
|
||||
"fast-deep-equal": "^1.0.0",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
||||
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
|
||||
"requires": {
|
||||
"safer-buffer": "2.1.2"
|
||||
"safer-buffer": "~2.1.0"
|
||||
}
|
||||
},
|
||||
"assert-plus": {
|
||||
@@ -38,7 +38,7 @@
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
|
||||
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
|
||||
"requires": {
|
||||
"lodash": "4.17.11"
|
||||
"lodash": "^4.17.10"
|
||||
}
|
||||
},
|
||||
"asynckit": {
|
||||
@@ -61,7 +61,7 @@
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
|
||||
"requires": {
|
||||
"tweetnacl": "0.14.5"
|
||||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"bluebird": {
|
||||
@@ -89,9 +89,9 @@
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
|
||||
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
|
||||
"requires": {
|
||||
"string-width": "1.0.2",
|
||||
"strip-ansi": "3.0.1",
|
||||
"wrap-ansi": "2.1.0"
|
||||
"string-width": "^1.0.1",
|
||||
"strip-ansi": "^3.0.1",
|
||||
"wrap-ansi": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"co": {
|
||||
@@ -114,7 +114,7 @@
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
|
||||
"integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
|
||||
"requires": {
|
||||
"delayed-stream": "1.0.0"
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"core-util-is": {
|
||||
@@ -132,7 +132,7 @@
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0"
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
@@ -140,7 +140,7 @@
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"requires": {
|
||||
"ms": "2.1.1"
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"decamelize": {
|
||||
@@ -158,8 +158,8 @@
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
|
||||
"requires": {
|
||||
"jsbn": "0.1.1",
|
||||
"safer-buffer": "2.1.2"
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"error-ex": {
|
||||
@@ -167,7 +167,7 @@
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
|
||||
"requires": {
|
||||
"is-arrayish": "0.2.1"
|
||||
"is-arrayish": "^0.2.1"
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
@@ -200,8 +200,8 @@
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
||||
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
|
||||
"requires": {
|
||||
"path-exists": "2.1.0",
|
||||
"pinkie-promise": "2.0.1"
|
||||
"path-exists": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"forever-agent": {
|
||||
@@ -214,9 +214,9 @@
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
|
||||
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||
"requires": {
|
||||
"asynckit": "0.4.0",
|
||||
"combined-stream": "1.0.7",
|
||||
"mime-types": "2.1.21"
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"get-caller-file": {
|
||||
@@ -229,7 +229,7 @@
|
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0"
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
@@ -247,8 +247,8 @@
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz",
|
||||
"integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==",
|
||||
"requires": {
|
||||
"ajv": "5.5.2",
|
||||
"har-schema": "2.0.0"
|
||||
"ajv": "^5.3.0",
|
||||
"har-schema": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"hosted-git-info": {
|
||||
@@ -261,9 +261,9 @@
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"jsprim": "1.4.1",
|
||||
"sshpk": "1.15.1"
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"invert-kv": {
|
||||
@@ -286,7 +286,7 @@
|
||||
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
||||
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
|
||||
"requires": {
|
||||
"builtin-modules": "1.1.1"
|
||||
"builtin-modules": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
@@ -294,7 +294,7 @@
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"requires": {
|
||||
"number-is-nan": "1.0.1"
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-typedarray": {
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
|
||||
"integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
|
||||
"requires": {
|
||||
"invert-kv": "1.0.0"
|
||||
"invert-kv": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"load-json-file": {
|
||||
@@ -361,11 +361,11 @@
|
||||
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"parse-json": "2.2.0",
|
||||
"pify": "2.3.0",
|
||||
"pinkie-promise": "2.0.1",
|
||||
"strip-bom": "2.0.0"
|
||||
"graceful-fs": "^4.1.2",
|
||||
"parse-json": "^2.2.0",
|
||||
"pify": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0",
|
||||
"strip-bom": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
@@ -383,7 +383,7 @@
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
|
||||
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
|
||||
"requires": {
|
||||
"mime-db": "1.37.0"
|
||||
"mime-db": "~1.37.0"
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
@@ -401,11 +401,11 @@
|
||||
"resolved": "https://registry.npmjs.org/node-ssdp/-/node-ssdp-3.3.0.tgz",
|
||||
"integrity": "sha512-hFBkfUJytKC2x64jljojAbktG8aOL0C1YuNjCK54ZGBBg2382J3oTuK17T+aFgmy47noKHE5arLnYppo0JjcLw==",
|
||||
"requires": {
|
||||
"async": "2.6.1",
|
||||
"bluebird": "3.5.2",
|
||||
"debug": "3.2.6",
|
||||
"extend": "3.0.2",
|
||||
"ip": "1.1.5"
|
||||
"async": "^2.6.0",
|
||||
"bluebird": "^3.5.1",
|
||||
"debug": "^3.1.0",
|
||||
"extend": "^3.0.1",
|
||||
"ip": "^1.1.5"
|
||||
}
|
||||
},
|
||||
"normalize-package-data": {
|
||||
@@ -413,10 +413,10 @@
|
||||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
|
||||
"requires": {
|
||||
"hosted-git-info": "2.7.1",
|
||||
"is-builtin-module": "1.0.0",
|
||||
"semver": "5.6.0",
|
||||
"validate-npm-package-license": "3.0.4"
|
||||
"hosted-git-info": "^2.1.4",
|
||||
"is-builtin-module": "^1.0.0",
|
||||
"semver": "2 || 3 || 4 || 5",
|
||||
"validate-npm-package-license": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"number-is-nan": {
|
||||
@@ -434,7 +434,7 @@
|
||||
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
||||
"requires": {
|
||||
"lcid": "1.0.0"
|
||||
"lcid": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"parse-json": {
|
||||
@@ -442,7 +442,7 @@
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
|
||||
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
|
||||
"requires": {
|
||||
"error-ex": "1.3.2"
|
||||
"error-ex": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"path-exists": {
|
||||
@@ -450,7 +450,7 @@
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
|
||||
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
|
||||
"requires": {
|
||||
"pinkie-promise": "2.0.1"
|
||||
"pinkie-promise": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"path-type": {
|
||||
@@ -458,9 +458,9 @@
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
||||
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"pify": "2.3.0",
|
||||
"pinkie-promise": "2.0.1"
|
||||
"graceful-fs": "^4.1.2",
|
||||
"pify": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"performance-now": {
|
||||
@@ -483,7 +483,7 @@
|
||||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
||||
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
||||
"requires": {
|
||||
"pinkie": "2.0.4"
|
||||
"pinkie": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"psl": {
|
||||
@@ -511,9 +511,9 @@
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
||||
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
|
||||
"requires": {
|
||||
"load-json-file": "1.1.0",
|
||||
"normalize-package-data": "2.4.0",
|
||||
"path-type": "1.1.0"
|
||||
"load-json-file": "^1.0.0",
|
||||
"normalize-package-data": "^2.3.2",
|
||||
"path-type": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"read-pkg-up": {
|
||||
@@ -521,8 +521,8 @@
|
||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
||||
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
|
||||
"requires": {
|
||||
"find-up": "1.1.2",
|
||||
"read-pkg": "1.1.0"
|
||||
"find-up": "^1.0.0",
|
||||
"read-pkg": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
@@ -530,26 +530,26 @@
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
|
||||
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
|
||||
"requires": {
|
||||
"aws-sign2": "0.7.0",
|
||||
"aws4": "1.8.0",
|
||||
"caseless": "0.12.0",
|
||||
"combined-stream": "1.0.7",
|
||||
"extend": "3.0.2",
|
||||
"forever-agent": "0.6.1",
|
||||
"form-data": "2.3.3",
|
||||
"har-validator": "5.1.0",
|
||||
"http-signature": "1.2.0",
|
||||
"is-typedarray": "1.0.0",
|
||||
"isstream": "0.1.2",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"mime-types": "2.1.21",
|
||||
"oauth-sign": "0.9.0",
|
||||
"performance-now": "2.1.0",
|
||||
"qs": "6.5.2",
|
||||
"safe-buffer": "5.1.2",
|
||||
"tough-cookie": "2.4.3",
|
||||
"tunnel-agent": "0.6.0",
|
||||
"uuid": "3.3.2"
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"har-validator": "~5.1.0",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.19",
|
||||
"oauth-sign": "~0.9.0",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.2",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.4.3",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"require-directory": {
|
||||
@@ -587,8 +587,8 @@
|
||||
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz",
|
||||
"integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==",
|
||||
"requires": {
|
||||
"spdx-expression-parse": "3.0.0",
|
||||
"spdx-license-ids": "3.0.1"
|
||||
"spdx-expression-parse": "^3.0.0",
|
||||
"spdx-license-ids": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"spdx-exceptions": {
|
||||
@@ -601,8 +601,8 @@
|
||||
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
|
||||
"integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
|
||||
"requires": {
|
||||
"spdx-exceptions": "2.2.0",
|
||||
"spdx-license-ids": "3.0.1"
|
||||
"spdx-exceptions": "^2.1.0",
|
||||
"spdx-license-ids": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"spdx-license-ids": {
|
||||
@@ -620,15 +620,15 @@
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz",
|
||||
"integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==",
|
||||
"requires": {
|
||||
"asn1": "0.2.4",
|
||||
"assert-plus": "1.0.0",
|
||||
"bcrypt-pbkdf": "1.0.2",
|
||||
"dashdash": "1.14.1",
|
||||
"ecc-jsbn": "0.1.2",
|
||||
"getpass": "0.1.7",
|
||||
"jsbn": "0.1.1",
|
||||
"safer-buffer": "2.1.2",
|
||||
"tweetnacl": "0.14.5"
|
||||
"asn1": "~0.2.3",
|
||||
"assert-plus": "^1.0.0",
|
||||
"bcrypt-pbkdf": "^1.0.0",
|
||||
"dashdash": "^1.12.0",
|
||||
"ecc-jsbn": "~0.1.1",
|
||||
"getpass": "^0.1.1",
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.0.2",
|
||||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"stack-trace": {
|
||||
@@ -641,9 +641,9 @@
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"requires": {
|
||||
"code-point-at": "1.1.0",
|
||||
"is-fullwidth-code-point": "1.0.0",
|
||||
"strip-ansi": "3.0.1"
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
"strip-ansi": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
@@ -651,7 +651,7 @@
|
||||
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"requires": {
|
||||
"ansi-regex": "2.1.1"
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"strip-bom": {
|
||||
@@ -659,7 +659,7 @@
|
||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
|
||||
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
|
||||
"requires": {
|
||||
"is-utf8": "0.2.1"
|
||||
"is-utf8": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
@@ -667,8 +667,8 @@
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
|
||||
"requires": {
|
||||
"psl": "1.1.29",
|
||||
"punycode": "1.4.1"
|
||||
"psl": "^1.1.24",
|
||||
"punycode": "^1.4.1"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
@@ -676,7 +676,7 @@
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
@@ -694,8 +694,8 @@
|
||||
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
|
||||
"requires": {
|
||||
"spdx-correct": "3.0.2",
|
||||
"spdx-expression-parse": "3.0.0"
|
||||
"spdx-correct": "^3.0.0",
|
||||
"spdx-expression-parse": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"verror": {
|
||||
@@ -703,9 +703,9 @@
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"assert-plus": "^1.0.0",
|
||||
"core-util-is": "1.0.2",
|
||||
"extsprintf": "1.3.0"
|
||||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"which-module": {
|
||||
@@ -718,12 +718,12 @@
|
||||
"resolved": "https://registry.npmjs.org/winston/-/winston-2.4.4.tgz",
|
||||
"integrity": "sha512-NBo2Pepn4hK4V01UfcWcDlmiVTs7VTB1h7bgnB0rgP146bYhMxX0ypCz3lBOfNxCO4Zuek7yeT+y/zM1OfMw4Q==",
|
||||
"requires": {
|
||||
"async": "1.0.0",
|
||||
"colors": "1.0.3",
|
||||
"cycle": "1.0.3",
|
||||
"eyes": "0.1.8",
|
||||
"isstream": "0.1.2",
|
||||
"stack-trace": "0.0.10"
|
||||
"async": "~1.0.0",
|
||||
"colors": "1.0.x",
|
||||
"cycle": "1.0.x",
|
||||
"eyes": "0.1.x",
|
||||
"isstream": "0.1.x",
|
||||
"stack-trace": "0.0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
@@ -743,8 +743,8 @@
|
||||
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||
"requires": {
|
||||
"string-width": "1.0.2",
|
||||
"strip-ansi": "3.0.1"
|
||||
"string-width": "^1.0.1",
|
||||
"strip-ansi": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"y18n": {
|
||||
@@ -757,19 +757,19 @@
|
||||
"resolved": "http://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz",
|
||||
"integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=",
|
||||
"requires": {
|
||||
"camelcase": "3.0.0",
|
||||
"cliui": "3.2.0",
|
||||
"decamelize": "1.2.0",
|
||||
"get-caller-file": "1.0.3",
|
||||
"os-locale": "1.4.0",
|
||||
"read-pkg-up": "1.0.1",
|
||||
"require-directory": "2.1.1",
|
||||
"require-main-filename": "1.0.1",
|
||||
"set-blocking": "2.0.0",
|
||||
"string-width": "1.0.2",
|
||||
"which-module": "1.0.0",
|
||||
"y18n": "3.2.1",
|
||||
"yargs-parser": "4.2.1"
|
||||
"camelcase": "^3.0.0",
|
||||
"cliui": "^3.2.0",
|
||||
"decamelize": "^1.1.1",
|
||||
"get-caller-file": "^1.0.1",
|
||||
"os-locale": "^1.4.0",
|
||||
"read-pkg-up": "^1.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^1.0.1",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^1.0.2",
|
||||
"which-module": "^1.0.0",
|
||||
"y18n": "^3.2.1",
|
||||
"yargs-parser": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
@@ -777,7 +777,7 @@
|
||||
"resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz",
|
||||
"integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=",
|
||||
"requires": {
|
||||
"camelcase": "3.0.0"
|
||||
"camelcase": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
93
server/tests/js_tests/tests/testEdgeCases.js
Normal file
93
server/tests/js_tests/tests/testEdgeCases.js
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
var dial = require("../libs/dialClient.js"),
|
||||
utils = require("../libs/utils.js"),
|
||||
Q = require("q"),
|
||||
winston = require("winston");
|
||||
|
||||
|
||||
const argv = require("yargs")
|
||||
.usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]")
|
||||
.option("host", {
|
||||
describe: "IP address of host on which DIAL server under test is running",
|
||||
type: "string",
|
||||
demand: true
|
||||
})
|
||||
.help("help").alias("help", "h").argv;
|
||||
|
||||
var testCount = 0;
|
||||
var failureCount = 0;
|
||||
|
||||
/*
|
||||
* These edge cases are
|
||||
*/
|
||||
function edgeCases() {
|
||||
var host = argv.host;
|
||||
|
||||
var methods = [
|
||||
"GET",
|
||||
"POST",
|
||||
];
|
||||
|
||||
// weird data
|
||||
var headers = [
|
||||
{"Content-Length": "0xff1af1581"},
|
||||
{"Content-Length": "sfsadfdsat"},
|
||||
{"Content-Length": 13377777777777},
|
||||
{"Content-Length": -13377777777777},
|
||||
{"Content-Type": "text/plain;charset=\"utf-8\""},
|
||||
{"Content-Type": "text/plain;charset=\"ascii\""},
|
||||
{"Content-Type": "asdoffmoaserq"},
|
||||
{"Foo": "Bar"},
|
||||
];
|
||||
|
||||
var utf8 = ";(QmN̸鱏=叽]𰸹h˳╭ܮ煣ِt𐍁J픖pЗB-ٴۼ퍃%۞灱Ҡɝ~2望Lԇƀݛ&±⫯WܾNJX礴ēʧ耉ݭpi}Ǖʝ'䬿^ٿ]샑좘쒾"
|
||||
+ "ԝbւ蹈ۥ웦(歉貤䃶6ƢӋØ𪺭ĩk┋譒ց,Ŋ칱آ3㛣Oܕ=裁fĴjٕpۅ=@ԉ'1⃮Ȩ핣ƺ匽ݚ뎔叇χ&죙𱘱ʴذȞ鞾ﰟO썟X9⛥ȧ走쾙"
|
||||
+ "ӱإ#!۵Σƀ4䦼쪭ϖ0ڧp梛՚嬆߷域᳁١ޜۡÜ]ʘ厤ȆwYݖ(ן饲a<61>`V<$Dz&ܗʧbҘ@E1ч&{㜃팸儈Ā㖿rb^Ӟʶ"
|
||||
+ "Ө㡷sΠ●ŽٗDҤƱ(t-瞜BЏ;Ғeࡻs`=ݔu樭迕^;䐈Ǥ3䝡XM붩ݱϖȓܕ췃`Ỷ3LV9폧赹ⴢ+⇩ӛ뵖띟䎵钥¶繥Ҕ J礢м2_8̑hg";
|
||||
utf8 = utf8 + utf8 + utf8;
|
||||
var strings = [
|
||||
utf8,
|
||||
"",
|
||||
'<a href="\x19javascript:javascript:alert(1)" id="fuzzelement1">test</a>\n',
|
||||
'$HOME',
|
||||
'../../../../../../../../../../../etc/hosts\n',
|
||||
];
|
||||
|
||||
// generate test cases
|
||||
var testCases = [];
|
||||
for (var m = 0; m < methods.length; m++) {
|
||||
for (var h = 0; h < headers.length; h++) {
|
||||
for (var q = 0; q < strings.length; q++) {
|
||||
for (var b = 0; b < strings.length; b++) {
|
||||
testCases.push(function (m, h, q, b) {
|
||||
return new Q()
|
||||
.then(dial.sendRequest.bind(null, host, methods[m], headers[h], strings[q], strings[b]))
|
||||
.then(function (response) {
|
||||
testCount = testCount + 1;
|
||||
if (![400, 404, 500].includes(response.statusCode)) {
|
||||
return Q.reject(new Error("Sent the DIAL server an edge case. Expected a bad status code but got " + response.statusCode));
|
||||
}
|
||||
})
|
||||
.fail(function handleError(err) {
|
||||
utils.printTestInfo(__filename.slice(__dirname.length + 1),
|
||||
"Edge Case, method: " + methods[m] + " header: "
|
||||
+ headers[h] + " query string: "
|
||||
+ strings[q] + " body: " + strings[b]);
|
||||
utils.printTestFailure(err);
|
||||
failureCount = failureCount + 1;
|
||||
return err;
|
||||
})
|
||||
}.bind(null, m, h, q, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return testCases;
|
||||
}
|
||||
|
||||
winston.info("Testing edge cases, only failing tests will appear.");
|
||||
return edgeCases().reduce(Q.when, Promise.resolve()).done(function() {
|
||||
winston.info("Tests complete. Passing: " + (testCount - failureCount) + ", Failures: " + failureCount);
|
||||
});
|
||||
@@ -78,6 +78,4 @@ Promise.resolve()
|
||||
// Application hide tests
|
||||
.then(hideInvalidApplicationInstance.test)
|
||||
.then(hideApplicationInHiddenState.test)
|
||||
.then(hideApplicationInRunningState.test)
|
||||
|
||||
|
||||
.then(hideApplicationInRunningState.test);
|
||||
|
||||
Reference in New Issue
Block a user