From 54c538ea56e57fdb3a5e22a516d4f82c8a084358 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Dec 2018 22:48:59 +0100 Subject: [PATCH 1/8] add test for the task --- .taskkey | 1 + NewmanPostman/newmantask.js | 16 +- Tests/TestSuite.js | 72 + Tests/TestSuite.ts | 80 + Tests/assets/Core.postman_collection.json | 1954 +++++++++++++++++++++ Tests/customReporterTest.js | 25 + Tests/customReporterTest.ts | 30 + Tests/emptyCollectionDir.js | 32 + Tests/emptyCollectionTest.js | 23 + Tests/emptyCollectionTest.ts | 27 + Tests/emptyContents.js | 32 + Tests/emptyContents.ts | 35 + Tests/folderTest.js | 25 + Tests/folderTest.ts | 30 + Tests/globalVarFileTest.js | 27 + Tests/globalVarFileTest.ts | 33 + Tests/globalVarTest.js | 26 + Tests/globalVarTest.ts | 31 + Tests/numberOfIterationTest.js | 25 + Tests/numberOfIterationTest.ts | 30 + Tests/test.js | 20 + package.json | 5 +- 22 files changed, 2571 insertions(+), 8 deletions(-) create mode 100644 .taskkey create mode 100644 Tests/TestSuite.js create mode 100644 Tests/TestSuite.ts create mode 100644 Tests/assets/Core.postman_collection.json create mode 100644 Tests/customReporterTest.js create mode 100644 Tests/customReporterTest.ts create mode 100644 Tests/emptyCollectionDir.js create mode 100644 Tests/emptyCollectionTest.js create mode 100644 Tests/emptyCollectionTest.ts create mode 100644 Tests/emptyContents.js create mode 100644 Tests/emptyContents.ts create mode 100644 Tests/folderTest.js create mode 100644 Tests/folderTest.ts create mode 100644 Tests/globalVarFileTest.js create mode 100644 Tests/globalVarFileTest.ts create mode 100644 Tests/globalVarTest.js create mode 100644 Tests/globalVarTest.ts create mode 100644 Tests/numberOfIterationTest.js create mode 100644 Tests/numberOfIterationTest.ts create mode 100644 Tests/test.js diff --git a/.taskkey b/.taskkey new file mode 100644 index 0000000..92c83c2 --- /dev/null +++ b/.taskkey @@ -0,0 +1 @@ +189f410b-3d17-4d7e-b0b7-9e96f2ad1af4 \ No newline at end of file diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index f281000..e52fd69 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -9,12 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); -const tl = require("vsts-task-lib"); +const tl = require("vsts-task-lib/task"); function GetToolRunner(collectionToRun) { - tl.debug("in GetToolRunner"); let pathToNewman = tl.getInput('pathToNewman', false); - tl.debug("Path to newman is : " + pathToNewman); - if (pathToNewman.length == 0) { + if (typeof pathToNewman != 'undefined' && pathToNewman) { + console.info("Specific path to newman found"); + } + else { + console.info("No specific path to newman, using default of 'newman'"); pathToNewman = "newman"; } var newman = tl.tool(tl.which(pathToNewman, true)); @@ -91,8 +93,8 @@ function GetToolRunner(collectionToRun) { function run() { return __awaiter(this, void 0, void 0, function* () { try { - tl.debug('executing newman'); - tl.setResourcePath(path.join(__dirname, './../task.json')); + // tl.debug('executing newman') + tl.setResourcePath(path.join(__dirname, 'task.json')); let collectionFileSource = tl.getPathInput('collectionFileSource', true, true); var taskSuccess = true; if (tl.stats(collectionFileSource).isDirectory()) { @@ -106,7 +108,7 @@ function run() { matchedFiles.forEach((file) => { var newman = GetToolRunner(file); var execResponse = newman.execSync(); - tl.debug(execResponse.stdout); + // tl.debug(execResponse.stdout); if (execResponse.code === 1) { console.log(execResponse); taskSuccess = false; diff --git a/Tests/TestSuite.js b/Tests/TestSuite.js new file mode 100644 index 0000000..2d1170a --- /dev/null +++ b/Tests/TestSuite.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mocktest = require("vsts-task-lib/mock-test"); +const path = require("path"); +const assert = require("assert"); +describe('Mandatory arguments', function () { + before(() => { }); + after(() => { }); + it('Error if collection file path is empty', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyCollectionTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source raise an error'); + done(); + }); + it('Error if collection is a directory and content not set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyContents.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); + done(); + }); +}); +describe('Other arguments', function () { + before(() => { }); + after(() => { }); + it('Multiple report format can be set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'customReporterTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('-r cli,json'), 'custom reporter format are set'); + done(); + }); + it('Number of iteration can be set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'numberOfIterationTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('-n 2'), 'number of iteration is set'); + done(); + }); + it('Folder can be set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'folderTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--folder /'), 'folder is set'); + done(); + }); + it('Global var file can be set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'globalVarFileTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--globals ' + __dirname), 'folder is set'); + done(); + }); + it('Multiple Global vars can be set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'globalVarTest.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--global-var var1=1 --global-var var2=2'), 'multiple variables are set'); + done(); + }); +}); diff --git a/Tests/TestSuite.ts b/Tests/TestSuite.ts new file mode 100644 index 0000000..836662f --- /dev/null +++ b/Tests/TestSuite.ts @@ -0,0 +1,80 @@ +import * as mocktest from 'vsts-task-lib/mock-test'; +import * as path from 'path'; +import * as assert from 'assert'; + +describe('Mandatory arguments', function () { + before(() => { }); + + after(() => { }); + + it('Error if collection file path is empty', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyCollectionTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source raise an error'); + done(); + }); + it('Error if collection is a directory and content not set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyContents.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); + done(); + }); +}); + +describe('Other arguments', function () { + before(() => { }); + + after(() => { }); + + it('Multiple report format can be set', (done: MochaDone) => { + this.timeout(1000); + + let testPath = path.join(__dirname, 'customReporterTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('-r cli,json'), 'custom reporter format are set'); + done(); + }); + + it('Number of iteration can be set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'numberOfIterationTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + assert(runner.stdOutContained('-n 2'), 'number of iteration is set'); + done(); + }); + + it('Folder can be set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'folderTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--folder /'), 'folder is set'); + done(); + }); + it('Global var file can be set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'globalVarFileTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--globals ' + __dirname), 'folder is set'); + done(); + }); + it('Multiple Global vars can be set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'globalVarTest.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('--global-var var1=1 --global-var var2=2'), 'multiple variables are set'); + done(); + }); +}); + diff --git a/Tests/assets/Core.postman_collection.json b/Tests/assets/Core.postman_collection.json new file mode 100644 index 0000000..bd639a7 --- /dev/null +++ b/Tests/assets/Core.postman_collection.json @@ -0,0 +1,1954 @@ +{ + "info": { + "_postman_id": "39418ab0-86c0-265e-a8c5-9a4517e5a5ea", + "name": "Core", + "description": "Test for Core API", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Roles", + "description": "Api for user roles", + "item": [ + { + "name": "Get Roles", + "event": [ + { + "listen": "test", + "script": { + "id": "006a4d7e-fc26-49a3-a540-6a7f619c67c7", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is more than one result\", function(){", + " pm.expect(responseData.length).to.above(1);", + "})", + "", + "var role = _.filter(responseData,{'Reference':pm.environment.get('AdminRoleRef')});", + "", + "pm.test (\"Role with reference '\"+pm.environment.get('AdminRoleRef')+\"' exist\", function(){", + " pm.expect(role.length).to.be.equal(1);", + "})", + "", + "pm.test (\"Data of role '4S7KP8WA' are correct\", function(){", + " pm.expect(role[0].Name).to.be.equal('Admin');", + " pm.expect(role[0].Priority).to.be.equal(0);", + " pm.expect(role[0].IsFrozen).to.be.equal(false);", + " pm.expect(role[0].IsActive).to.be.equal(true);", + " pm.expect(role[0].Permissions).to.be.an('Array');", + " pm.expect(role[0].Permissions.length).to.be.above(6);", + " pm.expect(role[0].Permissions[0]).to.have.all.keys([\"Code\",\"Type\",\"Value\",\"Priority\",\"RoleReference\"]);", + "})" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/roles", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "roles" + ] + }, + "description": "Récuparation de la liste des rôles" + }, + "response": [] + } + ] + }, + { + "name": "Currencies", + "description": "API for currencies", + "item": [ + { + "name": "Get currencies", + "event": [ + { + "listen": "test", + "script": { + "id": "751b86e4-efa5-4af0-a302-4ba1022763ae", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is 3 results\", function(){", + " pm.expect(responseData.length).to.eql(3);", + "});", + "", + "var expectedCurr =", + "[", + " {", + " \"Code\": \"USD\",", + " \"Name\": \"Dollar ($)\"", + " },", + " {", + " \"Code\": \"EUR\",", + " \"Name\": \"Euro (€)\"", + " },", + " {", + " \"Code\": \"GBP\",", + " \"Name\": \"Livre (£)\"", + " }", + "];", + "", + "", + "var returnedCurrencies= _.map(responseData,function(currency){", + " return {'Code':currency.Code,'Name':currency.Name};", + "});", + " ", + "", + "pm.test(\"Data for currency are correct\",function(){", + " pm.expect(returnedCurrencies).to.be.eql(expectedCurr)", + "});", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/currencies", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "currencies" + ] + }, + "description": "Get currencies" + }, + "response": [ + { + "id": "b460e5f4-afbb-4561-953c-5995e1512676", + "name": "Get currencies", + "originalRequest": { + "method": "GET", + "header": [], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/currencies", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "currencies" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Cache-Control", + "value": "no-cache", + "name": "Cache-Control", + "description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds" + }, + { + "key": "Content-Encoding", + "value": "gzip", + "name": "Content-Encoding", + "description": "The type of encoding used on the data." + }, + { + "key": "Content-Length", + "value": "4416", + "name": "Content-Length", + "description": "The length of the response body in octets (8-bit bytes)" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8", + "name": "Content-Type", + "description": "The mime type of this content" + }, + { + "key": "Date", + "value": "Thu, 11 Jan 2018 12:47:55 GMT", + "name": "Date", + "description": "The date and time that the message was sent" + }, + { + "key": "Expires", + "value": "-1", + "name": "Expires", + "description": "Gives the date/time after which the response is considered stale" + }, + { + "key": "Pragma", + "value": "no-cache", + "name": "Pragma", + "description": "Implementation-specific headers that may have various effects anywhere along the request-response chain." + }, + { + "key": "Server", + "value": "Microsoft-IIS/10.0", + "name": "Server", + "description": "A name for the server" + }, + { + "key": "Vary", + "value": "Accept-Encoding", + "name": "Vary", + "description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server." + }, + { + "key": "X-AspNet-Version", + "value": "4.0.30319", + "name": "X-AspNet-Version", + "description": "Custom header" + }, + { + "key": "X-Powered-By", + "value": "ASP.NET", + "name": "X-Powered-By", + "description": "Specifies the technology (ASP.NET, PHP, JBoss, e.g.) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)" + }, + { + "key": "x-config-header", + "value": "{\"UserLogin\":\"00000000\",\"UserReference\":\"00000000\",\"TenantReference\":\"00000000\",\"Environment\":\"Tests\",\"DatabaseCore\":\"itclients-dev-sql.database.windows.net/itclients-core-test\",\"DatabaseShared\":\"itclients-dev-sql.database.windows.net/itclients-1-test\",\"Version\":\"green-dev-201712-033\"}", + "name": "x-config-header", + "description": "Custom header" + } + ], + "cookie": [ + { + "expires": "Tue Jan 19 2038 04:14:07 GMT+0100 (Europe centrale)", + "httpOnly": true, + "domain": "itclients-api-core-test-green.azurewebsites.net", + "path": "/", + "secure": false, + "value": "91aced05e7bfcba071b08552743d98620b45e59ed3c0e6957468d0f97051ef7b", + "key": "ARRAffinity" + } + ], + "body": "[{\"Reference\":\"EUZQRX2M\",\"Code\":\"ALL\",\"Name\":\"Albania Lek\"},{\"Reference\":\"9ENKFP28\",\"Code\":\"DZD\",\"Name\":\"Algeria Dinar\"},{\"Reference\":\"CYEWYUWI\",\"Code\":\"AOA\",\"Name\":\"Angola Kwanza\"},{\"Reference\":\"E4DK5OJ8\",\"Code\":\"ARS\",\"Name\":\"Argentina Peso\"},{\"Reference\":\"E8CCV66L\",\"Code\":\"AMD\",\"Name\":\"Armenia Dram\"},{\"Reference\":\"14VFJFWA\",\"Code\":\"AWG\",\"Name\":\"Aruba Guilder\"},{\"Reference\":\"P89E3N82\",\"Code\":\"AUD\",\"Name\":\"Australia Dollar\"},{\"Reference\":\"M95CEFXX\",\"Code\":\"AZN\",\"Name\":\"Azerbaijan Manat\"},{\"Reference\":\"VSVCGJ6J\",\"Code\":\"BSD\",\"Name\":\"Bahamas Dollar\"},{\"Reference\":\"1LS6SMLA\",\"Code\":\"BHD\",\"Name\":\"Bahrain Dinar\"},{\"Reference\":\"NAUIST7H\",\"Code\":\"BDT\",\"Name\":\"Bangladesh Taka\"},{\"Reference\":\"27T5T57Q\",\"Code\":\"BBD\",\"Name\":\"Barbados Dollar\"},{\"Reference\":\"7C77TSEX\",\"Code\":\"BYN\",\"Name\":\"Belarus Ruble\"},{\"Reference\":\"REDUTIN9\",\"Code\":\"BZD\",\"Name\":\"Belize Dollar\"},{\"Reference\":\"EEJIQ0NR\",\"Code\":\"BMD\",\"Name\":\"Bermuda Dollar\"},{\"Reference\":\"Y337VVLT\",\"Code\":\"BTN\",\"Name\":\"Bhutan Ngultrum\"},{\"Reference\":\"ZCU1XMWP\",\"Code\":\"BOB\",\"Name\":\"Bolivia Bol?viano\"},{\"Reference\":\"BRFF5TGU\",\"Code\":\"BAM\",\"Name\":\"Bosnia and Herzegovina Convertible Marka\"},{\"Reference\":\"E5AMKPRU\",\"Code\":\"BWP\",\"Name\":\"Botswana Pula\"},{\"Reference\":\"UYN5A9W1\",\"Code\":\"BRL\",\"Name\":\"Brazil Real\"},{\"Reference\":\"5938TGMM\",\"Code\":\"BND\",\"Name\":\"Brunei Darussalam Dollar\"},{\"Reference\":\"8VTNRHZF\",\"Code\":\"BGN\",\"Name\":\"Bulgaria Lev\"},{\"Reference\":\"PRNCTN0H\",\"Code\":\"BIF\",\"Name\":\"Burundi Franc\"},{\"Reference\":\"EXNEJHE5\",\"Code\":\"KHR\",\"Name\":\"Cambodia Riel\"},{\"Reference\":\"OTIVPVJ5\",\"Code\":\"CAD\",\"Name\":\"Canada Dollar\"},{\"Reference\":\"UTGO275U\",\"Code\":\"CVE\",\"Name\":\"Cape Verde Escudo\"},{\"Reference\":\"A429GQP2\",\"Code\":\"KYD\",\"Name\":\"Cayman Islands Dollar\"},{\"Reference\":\"JJHKIOK9\",\"Code\":\"CLP\",\"Name\":\"Chile Peso\"},{\"Reference\":\"HHTU58PG\",\"Code\":\"CNY\",\"Name\":\"China Yuan Renminbi\"},{\"Reference\":\"EM2835KC\",\"Code\":\"COP\",\"Name\":\"Colombia Peso\"},{\"Reference\":\"BGLVISGB\",\"Code\":\"XOF\",\"Name\":\"Communaut? Financi?re Africaine (BCEAO)\"},{\"Reference\":\"4SV7HHLK\",\"Code\":\"XAF\",\"Name\":\"Communaut? Financi?re Africaine (BEAC)\"},{\"Reference\":\"KQZJ8Y8P\",\"Code\":\"KMF\",\"Name\":\"Comorian Franc\"},{\"Reference\":\"3UC8INA9\",\"Code\":\"XPF\",\"Name\":\"Comptoirs Fran?ais du Pacifique (CFP)\"},{\"Reference\":\"WSZW7130\",\"Code\":\"CDF\",\"Name\":\"Congo/Kinshasa Franc\"},{\"Reference\":\"TK3SAAIS\",\"Code\":\"CRC\",\"Name\":\"Costa Rica Colon\"},{\"Reference\":\"LVXB1P7I\",\"Code\":\"HRK\",\"Name\":\"Croatia Kuna\"},{\"Reference\":\"54ES1412\",\"Code\":\"CUC\",\"Name\":\"Cuba Convertible Peso\"},{\"Reference\":\"904YESK7\",\"Code\":\"CUP\",\"Name\":\"Cuba Peso\"},{\"Reference\":\"61JYWPGP\",\"Code\":\"CZK\",\"Name\":\"Czech Republic Koruna\"},{\"Reference\":\"AIXUAZM7\",\"Code\":\"DKK\",\"Name\":\"Denmark Krone\"},{\"Reference\":\"177ECVI6\",\"Code\":\"DJF\",\"Name\":\"Djibouti Franc\"},{\"Reference\":\"X1ZNE06G\",\"Code\":\"DOP\",\"Name\":\"Dominican Republic Peso\"},{\"Reference\":\"AZFUD7A8\",\"Code\":\"XCD\",\"Name\":\"East Caribbean Dollar\"},{\"Reference\":\"GRHG2UDM\",\"Code\":\"EGP\",\"Name\":\"Egypt Pound\"},{\"Reference\":\"QYZVBR0W\",\"Code\":\"SVC\",\"Name\":\"El Salvador Colon\"},{\"Reference\":\"VKOSH2JU\",\"Code\":\"ERN\",\"Name\":\"Eritrea Nakfa\"},{\"Reference\":\"HI558J1G\",\"Code\":\"ETB\",\"Name\":\"Ethiopia Birr\"},{\"Reference\":\"00000000\",\"Code\":\"EUR\",\"Name\":\"Euro Member Countries\"},{\"Reference\":\"5TFYHHQP\",\"Code\":\"FKP\",\"Name\":\"Falkland Islands (Malvinas) Pound\"},{\"Reference\":\"99L3QUVI\",\"Code\":\"FJD\",\"Name\":\"Fiji Dollar\"},{\"Reference\":\"WJ7DPVDQ\",\"Code\":\"GMD\",\"Name\":\"Gambia Dalasi\"},{\"Reference\":\"JOX1O5AA\",\"Code\":\"GEL\",\"Name\":\"Georgia Lari\"},{\"Reference\":\"FVJE0U1K\",\"Code\":\"GHS\",\"Name\":\"Ghana Cedi\"},{\"Reference\":\"FO23ZWL7\",\"Code\":\"GIP\",\"Name\":\"Gibraltar Pound\"},{\"Reference\":\"CHQ8CP0M\",\"Code\":\"GTQ\",\"Name\":\"Guatemala Quetzal\"},{\"Reference\":\"UG3SZ4U5\",\"Code\":\"GGP\",\"Name\":\"Guernsey Pound\"},{\"Reference\":\"9AUFU8BO\",\"Code\":\"GNF\",\"Name\":\"Guinea Franc\"},{\"Reference\":\"D0GT1IDC\",\"Code\":\"GYD\",\"Name\":\"Guyana Dollar\"},{\"Reference\":\"FROLSOGY\",\"Code\":\"HTG\",\"Name\":\"Haiti Gourde\"},{\"Reference\":\"J6MZHZDW\",\"Code\":\"HNL\",\"Name\":\"Honduras Lempira\"},{\"Reference\":\"VQF2GWC4\",\"Code\":\"HKD\",\"Name\":\"Hong Kong Dollar\"},{\"Reference\":\"MCXZQNDI\",\"Code\":\"HUF\",\"Name\":\"Hungary Forint\"},{\"Reference\":\"GDZVSY97\",\"Code\":\"ISK\",\"Name\":\"Iceland Krona\"},{\"Reference\":\"T8BSZWFG\",\"Code\":\"INR\",\"Name\":\"India Rupee\"},{\"Reference\":\"Q5O4Z93Y\",\"Code\":\"IDR\",\"Name\":\"Indonesia Rupiah\"},{\"Reference\":\"EHSROQ0F\",\"Code\":\"XDR\",\"Name\":\"International Monetary Fund (IMF)\"},{\"Reference\":\"DA94VPI6\",\"Code\":\"IRR\",\"Name\":\"Iran Rial\"},{\"Reference\":\"WGD4DDYX\",\"Code\":\"IQD\",\"Name\":\"Iraq Dinar\"},{\"Reference\":\"CSW4PESM\",\"Code\":\"IMP\",\"Name\":\"Isle of Man Pound\"},{\"Reference\":\"LVNDY93V\",\"Code\":\"ILS\",\"Name\":\"Israel Shekel\"},{\"Reference\":\"6EZYF3SD\",\"Code\":\"JMD\",\"Name\":\"Jamaica Dollar\"},{\"Reference\":\"JYDZ9K0H\",\"Code\":\"JPY\",\"Name\":\"Japan Yen\"},{\"Reference\":\"CNUEH3KH\",\"Code\":\"JEP\",\"Name\":\"Jersey Pound\"},{\"Reference\":\"G1A94HY0\",\"Code\":\"JOD\",\"Name\":\"Jordan Dinar\"},{\"Reference\":\"04X2GJFK\",\"Code\":\"KZT\",\"Name\":\"Kazakhstan Tenge\"},{\"Reference\":\"1YZYIANP\",\"Code\":\"KES\",\"Name\":\"Kenya Shilling\"},{\"Reference\":\"HXT0PJEK\",\"Code\":\"KPW\",\"Name\":\"Korea (North) Won\"},{\"Reference\":\"FZHIV93U\",\"Code\":\"KRW\",\"Name\":\"Korea (South) Won\"},{\"Reference\":\"H9F0Y1FL\",\"Code\":\"KWD\",\"Name\":\"Kuwait Dinar\"},{\"Reference\":\"HT1AEKNZ\",\"Code\":\"KGS\",\"Name\":\"Kyrgyzstan Som\"},{\"Reference\":\"34P4S95X\",\"Code\":\"LAK\",\"Name\":\"Laos Kip\"},{\"Reference\":\"TFD91I3Q\",\"Code\":\"LBP\",\"Name\":\"Lebanon Pound\"},{\"Reference\":\"Z9WG8XEQ\",\"Code\":\"LSL\",\"Name\":\"Lesotho Loti\"},{\"Reference\":\"2IFLH5BG\",\"Code\":\"LRD\",\"Name\":\"Liberia Dollar\"},{\"Reference\":\"UHP6YCFK\",\"Code\":\"LYD\",\"Name\":\"Libya Dinar\"},{\"Reference\":\"C60ZZT9F\",\"Code\":\"MOP\",\"Name\":\"Macau Pataca\"},{\"Reference\":\"AMJE2KA2\",\"Code\":\"MKD\",\"Name\":\"Macedonia Denar\"},{\"Reference\":\"MEYBGCUA\",\"Code\":\"MGA\",\"Name\":\"Madagascar Ariary\"},{\"Reference\":\"SX89YJ5Q\",\"Code\":\"MWK\",\"Name\":\"Malawi Kwacha\"},{\"Reference\":\"AVPHFCVB\",\"Code\":\"MYR\",\"Name\":\"Malaysia Ringgit\"},{\"Reference\":\"7V40APTA\",\"Code\":\"MVR\",\"Name\":\"Maldives (Maldive Islands) Rufiyaa\"},{\"Reference\":\"V6PE44TC\",\"Code\":\"MRO\",\"Name\":\"Mauritania Ouguiya\"},{\"Reference\":\"5FQMRA3Z\",\"Code\":\"MUR\",\"Name\":\"Mauritius Rupee\"},{\"Reference\":\"HFMIC3QZ\",\"Code\":\"MXN\",\"Name\":\"Mexico Peso\"},{\"Reference\":\"F9V9DITW\",\"Code\":\"MDL\",\"Name\":\"Moldova Leu\"},{\"Reference\":\"OH005D34\",\"Code\":\"MNT\",\"Name\":\"Mongolia Tughrik\"},{\"Reference\":\"968IUZ04\",\"Code\":\"MAD\",\"Name\":\"Morocco Dirham\"},{\"Reference\":\"06R7HL9C\",\"Code\":\"MZN\",\"Name\":\"Mozambique Metical\"},{\"Reference\":\"OHEBNFQC\",\"Code\":\"MMK\",\"Name\":\"Myanmar (Burma) Kyat\"},{\"Reference\":\"OCMB3BSH\",\"Code\":\"NAD\",\"Name\":\"Namibia Dollar\"},{\"Reference\":\"MHCV086C\",\"Code\":\"NPR\",\"Name\":\"Nepal Rupee\"},{\"Reference\":\"XY44YK4P\",\"Code\":\"ANG\",\"Name\":\"Netherlands Antilles Guilder\"},{\"Reference\":\"9QHCLOMR\",\"Code\":\"NZD\",\"Name\":\"New Zealand Dollar\"},{\"Reference\":\"8CGA1ZBR\",\"Code\":\"NIO\",\"Name\":\"Nicaragua Cordoba\"},{\"Reference\":\"J1YITB71\",\"Code\":\"NGN\",\"Name\":\"Nigeria Naira\"},{\"Reference\":\"YY9BHF7D\",\"Code\":\"NOK\",\"Name\":\"Norway Krone\"},{\"Reference\":\"G9USH50Y\",\"Code\":\"OMR\",\"Name\":\"Oman Rial\"},{\"Reference\":\"CAZTHD32\",\"Code\":\"PKR\",\"Name\":\"Pakistan Rupee\"},{\"Reference\":\"3WEBVIRJ\",\"Code\":\"PAB\",\"Name\":\"Panama Balboa\"},{\"Reference\":\"PLYILSHM\",\"Code\":\"PGK\",\"Name\":\"Papua New Guinea Kina\"},{\"Reference\":\"9ANSGLU2\",\"Code\":\"PYG\",\"Name\":\"Paraguay Guarani\"},{\"Reference\":\"VA5QX4IF\",\"Code\":\"PEN\",\"Name\":\"Peru Sol\"},{\"Reference\":\"XINHE8YB\",\"Code\":\"PHP\",\"Name\":\"Philippines Peso\"},{\"Reference\":\"ZSDDWA9K\",\"Code\":\"PLN\",\"Name\":\"Poland Zloty\"},{\"Reference\":\"QH02R8ZQ\",\"Code\":\"QAR\",\"Name\":\"Qatar Riyal\"},{\"Reference\":\"D5UA3SV8\",\"Code\":\"RON\",\"Name\":\"Romania Leu\"},{\"Reference\":\"LNNXEP7S\",\"Code\":\"RUB\",\"Name\":\"Russia Ruble\"},{\"Reference\":\"1DUC60LA\",\"Code\":\"RWF\",\"Name\":\"Rwanda Franc\"},{\"Reference\":\"8Q31KGCO\",\"Code\":\"STD\",\"Name\":\"S?o Tom? and Pr?ncipe Dobra\"},{\"Reference\":\"CZ6QIV8L\",\"Code\":\"SHP\",\"Name\":\"Saint Helena Pound\"},{\"Reference\":\"XMARG4MG\",\"Code\":\"WST\",\"Name\":\"Samoa Tala\"},{\"Reference\":\"OVUEUSSI\",\"Code\":\"SAR\",\"Name\":\"Saudi Arabia Riyal\"},{\"Reference\":\"XSIQTZXM\",\"Code\":\"RSD\",\"Name\":\"Serbia Dinar\"},{\"Reference\":\"3RDFOSMM\",\"Code\":\"SCR\",\"Name\":\"Seychelles Rupee\"},{\"Reference\":\"9QEGOOOH\",\"Code\":\"SLL\",\"Name\":\"Sierra Leone Leone\"},{\"Reference\":\"TCRM7ZGI\",\"Code\":\"SGD\",\"Name\":\"Singapore Dollar\"},{\"Reference\":\"2QQ3OMU5\",\"Code\":\"SBD\",\"Name\":\"Solomon Islands Dollar\"},{\"Reference\":\"6T8HJJCG\",\"Code\":\"SOS\",\"Name\":\"Somalia Shilling\"},{\"Reference\":\"SCY4SUG4\",\"Code\":\"ZAR\",\"Name\":\"South Africa Rand\"},{\"Reference\":\"04281QBW\",\"Code\":\"LKR\",\"Name\":\"Sri Lanka Rupee\"},{\"Reference\":\"Z9CIJUGF\",\"Code\":\"SDG\",\"Name\":\"Sudan Pound\"},{\"Reference\":\"PKOQROC1\",\"Code\":\"SRD\",\"Name\":\"Suriname Dollar\"},{\"Reference\":\"LOIZXJGA\",\"Code\":\"SZL\",\"Name\":\"Swaziland Lilangeni\"},{\"Reference\":\"IR469N0J\",\"Code\":\"SEK\",\"Name\":\"Sweden Krona\"},{\"Reference\":\"LU8FEFMA\",\"Code\":\"CHF\",\"Name\":\"Switzerland Franc\"},{\"Reference\":\"FMEVYNSI\",\"Code\":\"SYP\",\"Name\":\"Syria Pound\"},{\"Reference\":\"J778YI8V\",\"Code\":\"TWD\",\"Name\":\"Taiwan New Dollar\"},{\"Reference\":\"HHA6WMHL\",\"Code\":\"TJS\",\"Name\":\"Tajikistan Somoni\"},{\"Reference\":\"DAKAOMA0\",\"Code\":\"TZS\",\"Name\":\"Tanzania Shilling\"},{\"Reference\":\"HPSKUY8T\",\"Code\":\"THB\",\"Name\":\"Thailand Baht\"},{\"Reference\":\"F6LINXBY\",\"Code\":\"TOP\",\"Name\":\"Tonga Pa'anga\"},{\"Reference\":\"WYPYYDBG\",\"Code\":\"TTD\",\"Name\":\"Trinidad and Tobago Dollar\"},{\"Reference\":\"VOJLY8QK\",\"Code\":\"TND\",\"Name\":\"Tunisia Dinar\"},{\"Reference\":\"XQFE3015\",\"Code\":\"TRY\",\"Name\":\"Turkey Lira\"},{\"Reference\":\"YLS4MASZ\",\"Code\":\"TMT\",\"Name\":\"Turkmenistan Manat\"},{\"Reference\":\"8H1MAKFN\",\"Code\":\"TVD\",\"Name\":\"Tuvalu Dollar\"},{\"Reference\":\"QOXVDZ3S\",\"Code\":\"UGX\",\"Name\":\"Uganda Shilling\"},{\"Reference\":\"EX8EQ23U\",\"Code\":\"UAH\",\"Name\":\"Ukraine Hryvnia\"},{\"Reference\":\"DM8PJ33P\",\"Code\":\"GBP\",\"Name\":\"United Kingdom Pound\"},{\"Reference\":\"00000001\",\"Code\":\"USD\",\"Name\":\"United States Dollar\"},{\"Reference\":\"8T34I0KJ\",\"Code\":\"UYU\",\"Name\":\"Uruguay Peso\"},{\"Reference\":\"9V63WQ4D\",\"Code\":\"UZS\",\"Name\":\"Uzbekistan Som\"},{\"Reference\":\"LD7F66TV\",\"Code\":\"VUV\",\"Name\":\"Vanuatu Vatu\"},{\"Reference\":\"Y439HWRQ\",\"Code\":\"VEF\",\"Name\":\"Venezuela Bol?var\"},{\"Reference\":\"SX7TAGWM\",\"Code\":\"VND\",\"Name\":\"Viet Nam Dong\"},{\"Reference\":\"FHO1GB1X\",\"Code\":\"YER\",\"Name\":\"Yemen Rial\"},{\"Reference\":\"DIV3O40Q\",\"Code\":\"ZMW\",\"Name\":\"Zambia Kwacha\"},{\"Reference\":\"0MH4MZAS\",\"Code\":\"ZWD\",\"Name\":\"Zimbabwe Dollar\"}]" + } + ] + } + ] + }, + { + "name": "Users", + "description": "", + "item": [ + { + "name": "Get Users", + "event": [ + { + "listen": "test", + "script": { + "id": "dc685b0e-933c-4e93-b00c-2ce0a19752fe", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is more than 5 results\", function(){", + " pm.expect(responseData.length).to.above(4);", + "});", + "", + "var subsidiaryAdminLogin = pm.environment.get('User')", + "var subsAdmin = _.filter(responseData,{'Login':subsidiaryAdminLogin})", + "", + "pm.test(\"User '\"+subsidiaryAdminLogin+\"' is present\", function(){", + " pm.expect(subsAdmin.length).to.be.equal(1);", + "})", + "", + "pm.test (\"Data for user '\"+subsidiaryAdminLogin+\"' are correct\", function(){", + " pm.expect(subsAdmin[0].Reference).to.be.equal(pm.environment.get('UserRef'));", + " pm.expect(subsAdmin[0].LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", + " pm.expect(subsAdmin[0].FirstName).to.be.equal('Utilisateur');", + " pm.expect(subsAdmin[0].TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", + " pm.expect(subsAdmin[0].IsActive).to.be.equal(true);", + " pm.expect(subsAdmin[0].DefaultSubsidiaryReference).to.be.equal(pm.environment.get('CurrentSubsidiary'));", + " ", + " ", + "})" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/users", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "users" + ] + }, + "description": "Get list of user" + }, + "response": [] + }, + { + "name": "Get User", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "93d1b92f-1d91-408f-b132-0c75d99da37a", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "16d6bcb3-f95c-4e86-bdea-6b1c3771c6b7", + "type": "text/javascript", + "exec": [ + "var moment = require ('moment')", + "", + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test(\"Data of user with ref '\"+pm.environment.get('UserRef')+\"' are correct\", function () {", + " pm.expect (responseData.Reference).to.be.eql(pm.environment.get('UserRef'));", + " pm.expect(responseData.TenantReference).to.be.equals(pm.environment.get('CurrentTenant'));", + " pm.expect(responseData.DefaultSubsidiaryReference).to.be.equals(pm.environment.get('CurrentSubsidiary'));", + " pm.expect(responseData.Login).to.be.equals(pm.environment.get('User'));", + " pm.expect(responseData.FirstName).to.be.equals(\"Utilisateur\");", + " pm.expect(responseData.LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", + " pm.expect(responseData.Phone).to.be.equals(\"+33(0)1-02-03-04-05\");", + " pm.expect(responseData.EmailAddress).to.be.equals(\"s.carecolin@astonitf.com\");", + " pm.expect(responseData.Language).to.be.equals(\"FR\");", + " pm.expect(responseData.Function).to.be.equals(\"Président Directeur Général\");", + " pm.expect(responseData.TimeZone).to.be.equals(\"UTC+1\");", + " var m = moment(responseData.LastConnection);", + " pm.expect(m.isValid()).to.be.equals(true);", + " pm.expect(responseData.UserSubsidiaries.length).to.be.equals(3);", + " pm.expect(responseData.Permissions.length).to.be.above(15);", + " pm.expect(responseData.Permissions[0]).to.have.all.keys([\"Code\",\"Type\",\"Value\",\"Priority\",\"RoleReference\"]);", + "});", + "", + "", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/users/:userID", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "users", + ":userID" + ], + "variable": [ + { + "key": "userID", + "value": "{{UserRef}}", + "description": "Id of the user" + } + ] + }, + "description": "Verification du EndPoint Users" + }, + "response": [] + }, + { + "name": "Get user Token", + "event": [ + { + "listen": "test", + "script": { + "id": "bc7958c9-e773-4141-a2d7-5a1d1c170301", + "type": "text/javascript", + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "" + ] + } + }, + { + "listen": "prerequest", + "script": { + "id": "0f7a638d-253d-43de-baad-42809fb0983b", + "type": "text/javascript", + "exec": [ + "var loginPostData = {", + " \"Login\": pm.environment.get('User'),", + " \"Password\": pm.environment.get('Password')", + "};", + "", + "pm.globals.set (\"LoginPostData\", JSON.stringify(loginPostData))" + ] + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{{LoginPostData}}" + }, + "url": { + "raw": "{{CoreURL}}/api/configuration/users/Tokens", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "users", + "Tokens" + ] + } + }, + "response": [] + }, + { + "name": "Get users for a subsidiary", + "event": [ + { + "listen": "test", + "script": { + "id": "754ce822-2ae6-45f8-8af1-11bd34e8ea6f", + "type": "text/javascript", + "exec": [ + "var responseData= JSON.parse(responseBody)", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is more than on result\", function(){", + " pm.expect(responseData.length).to.be.above(0)", + "})", + "", + "pm.test(\"Data for user '\"+pm.environment.get('User')+\"' are correct\",function(){", + " var currentAdmin= _.filter(responseData,{'Login':pm.environment.get('User')})", + " pm.expect (currentAdmin.length).to.be.equal(1);", + " pm.expect (currentAdmin[0].Reference).to.be.equal(pm.environment.get('UserRef'));", + " pm.expect (currentAdmin[0].LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", + " pm.expect (currentAdmin[0].FirstName).to.be.equal('Utilisateur');", + " pm.expect (currentAdmin[0].TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", + " pm.expect (currentAdmin[0].IsActive).to.be.equal(true);", + " pm.expect (currentAdmin[0].DefaultSubsidiaryReference).to.be.equal(pm.environment.get('CurrentSubsidiary'));", + "})", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference/users", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "subsidiaries", + ":subsidiaryReference", + "users" + ], + "variable": [ + { + "key": "subsidiaryReference", + "value": "{{CurrentSubsidiary}}" + } + ] + }, + "description": "Get list of authorised user for a given subsidiary" + }, + "response": [] + } + ] + }, + { + "name": "Functions", + "description": "", + "item": [ + { + "name": "Get Functions", + "event": [ + { + "listen": "test", + "script": { + "id": "9f268bb8-b61d-41d7-b6b3-47ac20406abc", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test(\"There is 32 results\", function(){", + " pm.expect(responseData.length).to.be.equals(32);", + "})", + "", + "pm.test(\"Function 'Chargé de clientèle' is present\", function(){", + " pm.expect(_.filter(responseData,{'Name':'Chargé de clientèle'}).length).to.be.equal(1)", + "})" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/functions", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "functions" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Tenants", + "description": "", + "item": [ + { + "name": "Errors", + "description": "", + "item": [], + "_postman_isSubFolder": true + }, + { + "name": "Create Tenant", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d6eaa875-19b8-4235-a662-1e7957e23c41", + "type": "text/javascript", + "exec": [ + "var newTenantName= 'API Test Tenant-'+Date.now();", + "", + "var tenantData =", + "{", + " \"Name\":newTenantName,", + " \"CurrencyReference\": \"00000000\",", + " \"IsActive\": true,", + " \"TenantAgingBalanceSlices\": [", + " {", + " \"TenantAgingBalanceSliceReference\": null,", + " \"LowValue\": 0,", + " \"HighValue\": 30", + " },", + " {", + " \"TenantAgingBalanceSliceReference\": null,", + " \"LowValue\": 30,", + " \"HighValue\": 60", + " }", + " ]", + "};", + "", + "pm.globals.set(\"NewTenantData\",JSON.stringify(tenantData));" + ] + } + }, + { + "listen": "test", + "script": { + "id": "19bcdf50-17a6-443a-a351-6e5c033f9e99", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.globals.set('NewTenantRef', responseData.Reference);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"New Tenant informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", + " // TODO verify all fields....", + " pm.expect(responseData.Name).to.be.equal(postedData.Name);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", + " pm.expect(responseData.TenantAgingBalanceSlices).to.be.eql(postedData.TenantAgingBalanceSlices);", + "});" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{{NewTenantData}}" + }, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants" + ] + } + }, + "response": [] + }, + { + "name": "Get Tenants", + "event": [ + { + "listen": "test", + "script": { + "id": "734519ac-fe32-45f7-92ec-fa002e2773fc", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is more than one subsidiary in the list\",function(){", + " pm.expect(responseData.length).to.be.above(0);", + "});", + "", + "var newTenant = _.filter (responseData,{'Reference':pm.globals.get(\"NewTenantRef\")});", + "", + "pm.test(\"There is newly created tenant in the list\",function(){", + " pm.expect(newTenant.length).to.be.equal(1);", + "});", + "", + "pm.test(\"Returned data are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", + " //TODO change reponseDate by newTenant. ..", + " pm.expect(newTenant[0].Code).not.to.be.equal(null);", + " pm.expect(newTenant[0].Name).to.be.equal(postedData.Name);", + " pm.expect(newTenant[0].IsActive).to.be.equal(postedData.IsActive);", + " pm.expect(newTenant[0].StatusLabel).to.be.equal(\"Actif\");", + " pm.expect(newTenant[0].CountOfSubsidiaries).to.be.equal(0);", + "});" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants" + ] + } + }, + "response": [] + }, + { + "name": "Get Tenant", + "event": [ + { + "listen": "test", + "script": { + "id": "9229a172-351f-4660-95d0-8dc9c4da9c43", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test(\"New Tenant informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", + " pm.expect(responseData.Name).to.be.equal(postedData.Name);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", + " pm.expect(responseData.TenantAgingBalanceSlices).to.be.eql(postedData.TenantAgingBalanceSlices);", + "});", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json, text/json, application/xml, text/xml" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants/:TenantReference", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants", + ":TenantReference" + ], + "variable": [ + { + "key": "TenantReference", + "value": "{{NewTenantRef}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Update Tenant", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "6d517337-5330-4bdf-a470-e5882f6455c9", + "type": "text/javascript", + "exec": [ + "var updatedTenantName= 'API Test Tenant UDPATED'+Date.now();", + "pm.globals.set(\"updateTenantName\",updatedTenantName)", + "", + "var tenantUpdatedData =", + "{", + " \"Name\":updatedTenantName,", + " \"CurrencyReference\": \"00000000\",", + " \"IsActive\": false", + "};", + "", + "pm.globals.set(\"UpdatedTenantData\",JSON.stringify(tenantUpdatedData));" + ] + } + }, + { + "listen": "test", + "script": { + "id": "88d4504c-8f8a-4444-9dcb-af3508b1a242", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Updated subsidiary informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('UpdatedTenantData'));", + " pm.expect(responseData.Reference).to.be.equal(pm.globals.get('NewTenantRef'));", + " pm.expect(responseData.Name).to.be.equal(postedData.Name);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", + "});", + "", + "" + ] + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{{UpdatedTenantData}}" + }, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants/:tenantReference", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants", + ":tenantReference" + ], + "variable": [ + { + "key": "tenantReference", + "value": "{{NewTenantRef}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Tenant Subsidiaries", + "event": [ + { + "listen": "test", + "script": { + "id": "1d2c443f-8e94-4995-878a-14bc5395712f", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Number of elements is 0\", function(){", + " pm.expect(responseData.length).to.be.equals(0);", + "});", + "", + "// var specificSubs = _.filter(responseData,{'CompanyName':'Altaven-F1'});", + "", + "// pm.test(\"Results contains Altaven-F1\", function(){", + "// pm.expect(specificSubs.length).to.be.equal(1,'Filiale non trouvée');", + "// });", + "", + "// pm.test(\"Data for subsidiary 'Altaven-F1' are correct\", function(){", + "// pm.expect(specificSubs[0].Code).to.be.equal('9L6BW89EA6');", + "// pm.expect(specificSubs[0].IsActive).to.be.equal(true,'Statut incorrect');", + "// pm.expect(specificSubs[0].AttachedPortfoliosCount).to.be.equal(3, 'Nombre de filiale incorrecte');", + "// pm.expect(specificSubs[0].CurrencyCode).to.be.equal('EUR','Devise incorrecte');", + "// pm.expect(specificSubs[0].AttachedPortfolios.length).to.be.equal(3, 'Nombre de filiale incorrecte');", + "// });" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json, text/json, application/xml, text/xml" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants/:reference/subsidiaries", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants", + ":reference", + "subsidiaries" + ], + "variable": [ + { + "key": "reference", + "value": "{{NewTenantRef}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Subsidiaries", + "description": "", + "item": [ + { + "name": "Create Subsidiary", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "ec4e11a0-0a47-43ed-ae71-29cec1af3a2a", + "type": "text/javascript", + "exec": [ + "moment = require(\"moment\");", + "", + "var now =Date.now();", + "var signatureDate = moment(now).toISOString();", + "var openingDate = moment(now).add(1,'months').toISOString();", + "var newSubsidiaryName= \"Sté&Co-\"+now;", + " ", + "var subsidiaryData =", + "{", + " \"TenantReference\":pm.environment.get(\"CurrentTenant\"),", + " \"IsActive\": true,", + " \"CompanyName\":\"Sté&Co-\"+now,", + " \"TradeName\": \"societe\"+now,", + " \"LegalFormReference\": \"0FSXMQN3\",", + " \"IdType\": 0,", + " \"LegalId\": \"118956211\",", + " \"Nic\": \"\",", + " \"VatNumber\": \"FR52324598\",", + " \"Capital\": 500000.00,", + " \"CurrencyReference\": \"00000000\",", + " \"Address1\": \"16 place\",", + " \"Address2\": \"de la carriere\",", + " \"Address3\": \"\",", + " \"ZipCode\": \"5400\",", + " \"City\": \"NancY\",", + " \"CountryReference\": \"EUFRANCE\",", + " \"Phone\": \"+33(0)1-02-03-04-05\",", + " \"Language\": \"FR\",", + " \"ContractSignatureDate\": signatureDate,", + " \"ContractNumber\": \"123-ABC999\",", + " \"OpeningDate\": openingDate,", + " \"FiscalPeriodType\": 10,", + " \"FiscalPeriodStart\": \"01/01\",", + " \"FiscalPeriodEnd\": \"31/12\"", + "}", + "pm.globals.set(\"NewSubsidiaryData\",JSON.stringify(subsidiaryData));" + ] + } + }, + { + "listen": "test", + "script": { + "id": "49876b70-7846-4c0e-8df0-c4aeaf6eaa32", + "type": "text/javascript", + "exec": [ + "var moment= require('moment')", + "var responseData = JSON.parse(responseBody);", + "", + "pm.globals.set('NewSubsidiaryRef', responseData.Reference);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"New subsidiary informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", + " pm.expect(responseData.TenantReference).to.be.equal(postedData.TenantReference);", + " pm.expect(responseData.IsActive).to.be.equal(true);", + " pm.expect(responseData.Code).not.to.be.equal(null);", + " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", + " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", + " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", + " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", + " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", + " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", + " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", + " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.Adress1).to.be.equal(postedData.Adress1);", + " pm.expect(responseData.Adress2).to.be.equal(postedData.Adress2);", + " pm.expect(responseData.Adress3).to.be.equal(postedData.Adress3);", + " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", + " pm.expect(responseData.City).to.be.equal(postedData.City);", + " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", + " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", + " pm.expect(responseData.Language).to.be.equal(postedData.Language);", + " var m1 = moment(responseData.ContractSignatureDate);", + " pm.expect(m1.isValid()).to.be.equals(true);", + "", + " var m2 = moment(responseData.OpeningDate);", + " pm.expect(m2.isValid()).to.be.equals(true);", + " //Ensure diff between date is 1 month", + " //FIXME : not working !", + " //pm.expect(moment.duration(m1.diff(m2,'month'))).to.be.equal(1);", + " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", + " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", + " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", + " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", + "});", + "" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + }, + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{{NewSubsidiaryData}}" + }, + "url": { + "raw": "{{CoreURL}}/api/configuration/subsidiaries", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "subsidiaries" + ] + } + }, + "response": [] + }, + { + "name": "Get Subsidiary", + "event": [ + { + "listen": "test", + "script": { + "id": "8fe7302d-b225-4b09-9201-96818d236898", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody)", + "var moment= require('moment')", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"New subsidiary informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", + " pm.expect(responseData.TenantReference).to.be.equal(postedData.TenantReference);", + " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", + " pm.expect(responseData.Code).not.to.be.equal(null);", + " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", + " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", + " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", + " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", + " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", + " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", + " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", + " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.Address1).to.be.equal(postedData.Address1);", + " pm.expect(responseData.Address2).to.be.equal(postedData.Address2);", + " pm.expect(responseData.Address3).to.be.equal(postedData.Address3);", + " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", + " pm.expect(responseData.City).to.be.equal(postedData.City);", + " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", + " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", + " pm.expect(responseData.Language).to.be.equal(postedData.Language);", + " var m1 = moment(responseData.ContractSignatureDate);", + " pm.expect(m1.isValid()).to.be.equals(true);", + " var m2 = moment(responseData.OpeningDate);", + " pm.expect(m2.isValid()).to.be.equals(true);", + " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", + " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", + " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", + " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", + "});", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "subsidiaries", + ":subsidiaryReference" + ], + "variable": [ + { + "key": "subsidiaryReference", + "value": "{{NewSubsidiaryRef}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Tenant Subsidiaries", + "event": [ + { + "listen": "test", + "script": { + "id": "abd5d399-2462-4812-bf7e-4a32a871a767", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "var moment = require('moment');", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test (\"There is at least 4 results\", function(){", + " pm.expect (responseData.length).to.be.above(3);", + "})", + "", + "var postedData= JSON.parse(pm.globals.get('NewSubsidiaryData'));", + "var specificSubs = _.filter(responseData,{'Reference':pm.globals.get('NewSubsidiaryRef')});", + "", + "pm.test(\"Results contains subsidiary '\"+postedData.CompanyName+\"'\", function(){", + " pm.expect(specificSubs.length).to.be.equal(1);", + "});", + "", + "", + "pm.test(\"Data for subsidiary '\"+postedData.CompanyName+\"' are correct\", function(){", + " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", + " pm.expect(specificSubs[0].Code).not.to.be.equal(null);", + " pm.expect(specificSubs[0].CompanyName).to.be.equal(postedData.CompanyName);", + " pm.expect(specificSubs[0].IsActive).to.be.equal(postedData.IsActive);", + " var m1 = moment(specificSubs[0].CreationDate);", + " pm.expect(m1.isValid()).to.be.equals(true);", + " pm.expect(specificSubs[0].CurrencyCode).to.be.equal(\"EUR\");", + " pm.expect(specificSubs[0].IsDunningModuleActived).to.be.equal(false);", + " pm.expect(specificSubs[0].IsCreditInsuranceModuleActived).to.be.equal(false);", + " pm.expect(specificSubs[0].IsFactoringModuleActived).to.be.equal(false);", + " pm.expect(specificSubs[0].AttachedPortfoliosCount).to.be.equal(0);", + " pm.expect(specificSubs[0].AttachedPortfolios).to.be.eql(null);", + "});" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json, text/json, application/xml, text/xml", + "disabled": true + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/tenants/:reference/subsidiaries", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "tenants", + ":reference", + "subsidiaries" + ], + "variable": [ + { + "key": "reference", + "value": "{{CurrentTenant}}" + } + ] + }, + "description": "Ensure newly create subsidiary is linked to tenants" + }, + "response": [] + }, + { + "name": "Update Subsidiary", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "f52bd56c-5712-4261-9104-8e591a21bc9e", + "type": "text/javascript", + "exec": [ + "var now =Date.now();", + "", + "var newCieName = \"MyNewCompanie\"+now;", + "var newTradeName = \"Société \"+now;", + "", + "var subsidiaryUpdatedData =", + "{ ", + " \"TenantReference\":pm.environment.get(\"CurrentTenant\"),", + " \"IsActive\": true,", + " \"Code\": \"RSEGQ5WUYC\",", + " \"CompanyName\": newCieName,", + " \"TradeName\": newTradeName,", + " \"LegalFormReference\": \"QZKRXJPA\",", + " \"IdType\": 1,", + " \"LegalId\": \"118156478\",", + " \"Nic\": \"027\",", + " \"VatNumber\": \"FR52525252\",", + " \"Capital\": 50000.00,", + " \"CurrencyReference\": \"DM8PJ33P\",", + " \"Address1\": \"16 place\",", + " \"Address2\": \"de la carrière\",", + " \"Address3\": \"complement adresse 3 \",", + " \"ZipCode\": \"54000\",", + " \"City\": \"NancY\",", + " \"CountryReference\": \"EUFRANCE\",", + " \"Phone\": \"+33(0)1-02-03-04-05\",", + " \"Language\": \"FR\",", + " \"ContractSignatureDate\": \"2018-04-18T11:51:46.618\",", + " \"OpeningDate\": \"2018-05-18T11:51:46.618\",", + " \"ContractNumber\": \"AAA89-AAZZ\",", + " \"FiscalPeriodType\": 10,", + " \"FiscalPeriodStart\": \"01/01\",", + " \"FiscalPeriodEnd\": \"31/12\"", + "}", + "pm.globals.set(\"UpdatedSubsidiaryData\",JSON.stringify(subsidiaryUpdatedData));" + ] + } + }, + { + "listen": "test", + "script": { + "id": "28f8237e-daad-40ae-9f2e-8dc561c166db", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "var moment= require('moment')", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Updated subsidiary informations are sent\",function(){", + " pm.expect(responseData).to.be.an('object');", + "});", + "", + "pm.test(\"Informations sent back are correct\",function(){", + " var postedData = JSON.parse (pm.globals.get('UpdatedSubsidiaryData'));", + " //TODO verify all fields....", + " pm.expect(responseData.Reference).to.be.equal(pm.globals.get('NewSubsidiaryRef'));", + " pm.expect(responseData.TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", + " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", + " pm.expect(responseData.Code).not.to.be.equal(null);", + " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", + " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", + " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", + " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", + " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", + " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", + " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", + " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", + " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", + " pm.expect(responseData.Address1).to.be.equal(postedData.Address1);", + " pm.expect(responseData.Address2).to.be.equal(postedData.Address2);", + " pm.expect(responseData.Address3).to.be.equal(postedData.Address3);", + " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", + " pm.expect(responseData.City).to.be.equal(postedData.City);", + " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", + " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", + " pm.expect(responseData.Language).to.be.equal(postedData.Language);", + " pm.expect(responseData.ContractSignatureDate).to.be.equal(postedData.ContractSignatureDate);", + " var m1 = moment(responseData.ContractSignatureDate);", + " pm.expect(m1.isValid()).to.be.equals(true);", + " pm.expect(responseData.OpeningDate).to.be.equal(postedData.OpeningDate);", + " var m2 = moment(responseData.OpeningDate);", + " pm.expect(m2.isValid()).to.be.equals(true);", + " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", + " pm.expect(responseData.OpeningDate).to.be.equal(postedData.OpeningDate);", + " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", + " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", + " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", + "});", + "" + ] + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{{UpdatedSubsidiaryData}}" + }, + "url": { + "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "subsidiaries", + ":subsidiaryReference" + ], + "variable": [ + { + "key": "subsidiaryReference", + "value": "{{NewSubsidiaryRef}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get User Subsidiaries", + "event": [ + { + "listen": "test", + "script": { + "id": "e6f51aae-5a62-45c6-820b-0e99634e27f5", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse (responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Number of elements is 3\", function(){", + " pm.expect(responseData.length).to.be.equals(3);", + "})", + "", + "", + "var expectedSubs =[\"S21-TestBack\",\"S22-TestBack\",\"S23-TestBack\"];", + "_.each (expectedSubs, function (sub){", + " isPresent =_.filter (responseData,{\"CompanyName\":sub});", + " pm.test(\"Results contains correct subsidiary \"+ sub, function(){", + " pm.expect(isPresent.length).to.be.equal(1);", + " ", + " });", + "});", + "", + " ", + "", + "" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + }, + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/users/:userReference/subsidiaries", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "users", + ":userReference", + "subsidiaries" + ], + "variable": [ + { + "key": "userReference", + "value": "{{UserRef}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Language", + "description": "", + "item": [ + { + "name": "Get Translations", + "event": [ + { + "listen": "test", + "script": { + "id": "83736688-2d37-49ac-82a7-20cb7ba17d7c", + "type": "text/javascript", + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"There is some results\", function(){", + " pm.expect(responseBody.length).to.be.above(0);", + "})", + "", + "" + ] + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json, text/json, application/xml, text/xml" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/translations/:language", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "translations", + ":language" + ], + "variable": [ + { + "key": "language", + "value": "FR" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Supported Languages", + "event": [ + { + "listen": "test", + "script": { + "id": "fd8e5421-896a-4472-a1ee-08988edb52ee", + "type": "text/javascript", + "exec": [ + "", + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "pm.test(\"Number of elements is 2\", function(){", + " pm.expect(responseData.length).to.be.equals(2);", + "});", + "", + "pm.test(\"Results contains correct data for FR language\", function(){", + " var FR = _.filter (responseData,{Code:'FR'});", + " pm.expect(FR[0].Code).to.be.equals('FR');", + " pm.expect(FR[0].EnglishDescription).to.be.equals('French');", + " pm.expect(FR[0].LocaleDescription).to.be.equals('Français');", + "});", + "" + ] + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json, text/json, application/xml, text/xml" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/translations/SupportedLanguages", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "translations", + "SupportedLanguages" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "848466c0-082f-4f9f-8df3-2def1e58bf60", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "3d21f020-0144-4a4e-b876-2f6294c7a50a", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Country", + "description": "", + "item": [ + { + "name": "Get Countries", + "event": [ + { + "listen": "test", + "script": { + "id": "42b9639c-ac8e-414e-a855-17430caf34d2", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse (responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test (\"There is 250 results\", function(){", + " pm.expect(responseData.length).to.be.equal(250);", + "})", + "", + "pm.test(\"Data for country 'FRANCE' are present and correct\",function(){", + " var france = _.filter(responseData, {'Reference':'EUFRANCE'});", + " console.log(france);", + " pm.expect(france.length).to.be.equal(1);", + " pm.expect(france[0].Code).to.be.equal('FRA');", + " pm.expect(france[0].CodeIso2).to.be.equal('FR');", + " pm.expect(france[0].Name).to.be.equal('France');", + "})" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentSubsidiary", + "value": "{{CurrentSubsidiary}}" + }, + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/countries", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "countries" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "LegalForms", + "description": "", + "item": [ + { + "name": "Get legalForms", + "event": [ + { + "listen": "test", + "script": { + "id": "ccb61788-121e-4034-b020-c5698177ed8e", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test (\"There is 5 results\", function(){", + " pm.expect(responseData.length).to.be.equal(5);", + "});", + "", + "pm.test(\"All legal form are returned\", function(){", + " var legalForms = ['Autre forme juridique','Société à responsabilité limitée','Société anonyme','Société par actions simplifiée','Société par actions simplifiée unipersonnelle'];", + " _.each(legalForms, function(legalform) {", + " var current = _.filter(responseData, {'Name':legalform});", + " pm.expect(current.length).to.be.equal(1);", + " });", + "});" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/legalForms", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "legalForms" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "26235f19-c0e1-4326-a860-5b3f7b967816", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "1c90e60d-d768-469b-87fa-8ee6fae4abe2", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Enums", + "description": "", + "item": [ + { + "name": "Get FiscalPeriod", + "event": [ + { + "listen": "test", + "script": { + "id": "064dd5f6-e4e7-475b-89b8-d69b681bdbfd", + "type": "text/javascript", + "exec": [ + "var responseData = JSON.parse(responseBody);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test (\"Data are correct\",function(){", + " var expected ={", + " \"10\": \"Année civile\",", + " \"20\": \"Autre période\"", + "};", + "pm.expect(responseData).to.be.eql(expected)", + " ", + "})" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "CurrentLanguage", + "value": "fr" + } + ], + "body": {}, + "url": { + "raw": "{{CoreURL}}/api/configuration/enums/FiscalPeriods", + "host": [ + "{{CoreURL}}" + ], + "path": [ + "api", + "configuration", + "enums", + "FiscalPeriods" + ] + } + }, + "response": [] + } + ] + } + ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{newToken}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "7c95066e-ba35-4d91-bb6d-1ef33e76a0c3", + "type": "text/javascript", + "exec": [ + "", + "const userTokenRequest = {", + " url: pm.environment.get(\"CoreURL\")+'/api/configuration/users/Tokens',", + " method: 'POST',", + " header: 'Content-type:application/json',", + " body: {", + " mode: 'raw',", + " raw:JSON.stringify( {", + " Login: pm.environment.get('User'),", + " Password : pm.environment.get('Password')", + " })", + " }", + "};", + "", + "pm.sendRequest(userTokenRequest, function(err, response) {", + " pm.globals.set('newToken',response.json());", + " console.log(err ? err : response.json());", + "});", + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "c5c69935-c85f-459c-bab9-414d788f3372", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "id": "028e8e90-163f-44e2-ad2c-48d13976674a", + "key": "responseTime", + "value": "150", + "type": "string", + "description": "" + } + ] +} \ No newline at end of file diff --git a/Tests/customReporterTest.js b/Tests/customReporterTest.js new file mode 100644 index 0000000..ec655b2 --- /dev/null +++ b/Tests/customReporterTest.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput("environment", environment); +runner.setInput("reporters", 'cli,json'); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/customReporterTest.ts b/Tests/customReporterTest.ts new file mode 100644 index 0000000..7edf0ca --- /dev/null +++ b/Tests/customReporterTest.ts @@ -0,0 +1,30 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environment",environment); +runner.setInput("reporters",'cli,json'); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/emptyCollectionDir.js b/Tests/emptyCollectionDir.js new file mode 100644 index 0000000..0bdf980 --- /dev/null +++ b/Tests/emptyCollectionDir.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +console.info(taskPath); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.registerMockExport('stats', (itemPath) => { + console.log('##vso[task.debug]stats ' + itemPath); + switch (itemPath) { + case filePath: + return { isDirectory: () => true }; + default: + return true; + } +}); +runner.run(); diff --git a/Tests/emptyCollectionTest.js b/Tests/emptyCollectionTest.js new file mode 100644 index 0000000..1ae2823 --- /dev/null +++ b/Tests/emptyCollectionTest.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +console.info(taskPath); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = ''; +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/emptyCollectionTest.ts b/Tests/emptyCollectionTest.ts new file mode 100644 index 0000000..78f44a4 --- /dev/null +++ b/Tests/emptyCollectionTest.ts @@ -0,0 +1,27 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath=''; +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/emptyContents.js b/Tests/emptyContents.js new file mode 100644 index 0000000..d078c98 --- /dev/null +++ b/Tests/emptyContents.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +console.info(taskPath); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", ''); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.registerMockExport('stats', (itemPath) => { + console.log('##vso[task.debug]stats ' + itemPath); + switch (itemPath) { + case filePath: + return { isDirectory: () => true }; + default: + return true; + } +}); +runner.run(); diff --git a/Tests/emptyContents.ts b/Tests/emptyContents.ts new file mode 100644 index 0000000..29d5305 --- /dev/null +++ b/Tests/emptyContents.ts @@ -0,0 +1,35 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents",''); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.registerMockExport('stats', (itemPath: string) => { + console.log('##vso[task.debug]stats ' + itemPath); + switch (itemPath) { + case filePath: + return { isDirectory: () => true }; + default: + return true; + } +}) +runner.run(); \ No newline at end of file diff --git a/Tests/folderTest.js b/Tests/folderTest.js new file mode 100644 index 0000000..0dbf00b --- /dev/null +++ b/Tests/folderTest.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput("environment", environment); +runner.setInput("folder", '/'); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/folderTest.ts b/Tests/folderTest.ts new file mode 100644 index 0000000..95e7252 --- /dev/null +++ b/Tests/folderTest.ts @@ -0,0 +1,30 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environment",environment); +runner.setInput("folder",'/'); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/globalVarFileTest.js b/Tests/globalVarFileTest.js new file mode 100644 index 0000000..faa3588 --- /dev/null +++ b/Tests/globalVarFileTest.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +let globalVariables = __dirname; +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput("environment", environment); +runner.setInput("globalVariables", globalVariables); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +answers.checkPath[globalVariables] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/globalVarFileTest.ts b/Tests/globalVarFileTest.ts new file mode 100644 index 0000000..6bf09b5 --- /dev/null +++ b/Tests/globalVarFileTest.ts @@ -0,0 +1,33 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +let globalVariables =__dirname; + +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environment",environment); +runner.setInput("globalVariables",globalVariables); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +answers.checkPath[globalVariables]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/globalVarTest.js b/Tests/globalVarTest.js new file mode 100644 index 0000000..8b0a1b6 --- /dev/null +++ b/Tests/globalVarTest.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +let globalVars = "var1=1\nvar2=2"; +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput("environment", environment); +runner.setInput("globalVars", globalVars); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/globalVarTest.ts b/Tests/globalVarTest.ts new file mode 100644 index 0000000..f85f181 --- /dev/null +++ b/Tests/globalVarTest.ts @@ -0,0 +1,31 @@ +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +let globalVars ="var1=1\nvar2=2"; + +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environment",environment); +runner.setInput("globalVars",globalVars); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/numberOfIterationTest.js b/Tests/numberOfIterationTest.js new file mode 100644 index 0000000..325e555 --- /dev/null +++ b/Tests/numberOfIterationTest.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mockrun = require("vsts-task-lib/mock-run"); +const path = require("path"); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); +let runner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput("environment", environment); +runner.setInput("numberOfIterations", '2'); +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats: {} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath] = true; +runner.setAnswers(answers); +runner.run(); diff --git a/Tests/numberOfIterationTest.ts b/Tests/numberOfIterationTest.ts new file mode 100644 index 0000000..99e08b0 --- /dev/null +++ b/Tests/numberOfIterationTest.ts @@ -0,0 +1,30 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environment",environment); +runner.setInput("numberOfIterations",'2'); + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/test.js b/Tests/test.js new file mode 100644 index 0000000..8aac6f8 --- /dev/null +++ b/Tests/test.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const mocktest = require("vsts-task-lib/mock-test"); +const path = require("path"); +const assert = require("assert"); +describe('Mandatory arguments', function () { + before(() => { }); + after(() => { }); + it('Error if collection file path is empty', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyCollectionTest.js'); + console.info(testPath); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // assert(runner.succeeded, 'should have succeeded'); + console.error(runner.stdout); + assert.equal(runner.errorIssues.length, 0, 'NO ERROR'); + done(); + }); +}); diff --git a/package.json b/package.json index bfd22c3..70569ed 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,12 @@ "gallery-publish-rev": "tfx extension publish --rev-version", "clean": "rimraf ./*.vsix", "compile": "tsc -p .", - "install-task-lib": "cd NewmanPostman && npm install --save-dev" + "install-task-lib": "cd NewmanPostman && npm install --save-dev", + "pretest": "tsc -p .", + "test": "mocha Tests\\TestSuite.js" }, "devDependencies": { + "@types/mocha": "^5.2.5", "@types/node": "^8.0.7", "tfx-cli": "^0.6.1", "typescript": "2.3.4" From d0a5729b78f7198bc15d8eb3eb95ffc7d865ce5f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Dec 2018 23:15:10 +0100 Subject: [PATCH 2/8] updateAssetFile --- Tests/assets/Core.postman_collection.json | 1813 --------------------- 1 file changed, 1813 deletions(-) diff --git a/Tests/assets/Core.postman_collection.json b/Tests/assets/Core.postman_collection.json index bd639a7..62592dd 100644 --- a/Tests/assets/Core.postman_collection.json +++ b/Tests/assets/Core.postman_collection.json @@ -77,1819 +77,6 @@ "response": [] } ] - }, - { - "name": "Currencies", - "description": "API for currencies", - "item": [ - { - "name": "Get currencies", - "event": [ - { - "listen": "test", - "script": { - "id": "751b86e4-efa5-4af0-a302-4ba1022763ae", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"There is 3 results\", function(){", - " pm.expect(responseData.length).to.eql(3);", - "});", - "", - "var expectedCurr =", - "[", - " {", - " \"Code\": \"USD\",", - " \"Name\": \"Dollar ($)\"", - " },", - " {", - " \"Code\": \"EUR\",", - " \"Name\": \"Euro (€)\"", - " },", - " {", - " \"Code\": \"GBP\",", - " \"Name\": \"Livre (£)\"", - " }", - "];", - "", - "", - "var returnedCurrencies= _.map(responseData,function(currency){", - " return {'Code':currency.Code,'Name':currency.Name};", - "});", - " ", - "", - "pm.test(\"Data for currency are correct\",function(){", - " pm.expect(returnedCurrencies).to.be.eql(expectedCurr)", - "});", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/currencies", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "currencies" - ] - }, - "description": "Get currencies" - }, - "response": [ - { - "id": "b460e5f4-afbb-4561-953c-5995e1512676", - "name": "Get currencies", - "originalRequest": { - "method": "GET", - "header": [], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/currencies", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "currencies" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Cache-Control", - "value": "no-cache", - "name": "Cache-Control", - "description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds" - }, - { - "key": "Content-Encoding", - "value": "gzip", - "name": "Content-Encoding", - "description": "The type of encoding used on the data." - }, - { - "key": "Content-Length", - "value": "4416", - "name": "Content-Length", - "description": "The length of the response body in octets (8-bit bytes)" - }, - { - "key": "Content-Type", - "value": "application/json; charset=utf-8", - "name": "Content-Type", - "description": "The mime type of this content" - }, - { - "key": "Date", - "value": "Thu, 11 Jan 2018 12:47:55 GMT", - "name": "Date", - "description": "The date and time that the message was sent" - }, - { - "key": "Expires", - "value": "-1", - "name": "Expires", - "description": "Gives the date/time after which the response is considered stale" - }, - { - "key": "Pragma", - "value": "no-cache", - "name": "Pragma", - "description": "Implementation-specific headers that may have various effects anywhere along the request-response chain." - }, - { - "key": "Server", - "value": "Microsoft-IIS/10.0", - "name": "Server", - "description": "A name for the server" - }, - { - "key": "Vary", - "value": "Accept-Encoding", - "name": "Vary", - "description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server." - }, - { - "key": "X-AspNet-Version", - "value": "4.0.30319", - "name": "X-AspNet-Version", - "description": "Custom header" - }, - { - "key": "X-Powered-By", - "value": "ASP.NET", - "name": "X-Powered-By", - "description": "Specifies the technology (ASP.NET, PHP, JBoss, e.g.) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)" - }, - { - "key": "x-config-header", - "value": "{\"UserLogin\":\"00000000\",\"UserReference\":\"00000000\",\"TenantReference\":\"00000000\",\"Environment\":\"Tests\",\"DatabaseCore\":\"itclients-dev-sql.database.windows.net/itclients-core-test\",\"DatabaseShared\":\"itclients-dev-sql.database.windows.net/itclients-1-test\",\"Version\":\"green-dev-201712-033\"}", - "name": "x-config-header", - "description": "Custom header" - } - ], - "cookie": [ - { - "expires": "Tue Jan 19 2038 04:14:07 GMT+0100 (Europe centrale)", - "httpOnly": true, - "domain": "itclients-api-core-test-green.azurewebsites.net", - "path": "/", - "secure": false, - "value": "91aced05e7bfcba071b08552743d98620b45e59ed3c0e6957468d0f97051ef7b", - "key": "ARRAffinity" - } - ], - "body": "[{\"Reference\":\"EUZQRX2M\",\"Code\":\"ALL\",\"Name\":\"Albania Lek\"},{\"Reference\":\"9ENKFP28\",\"Code\":\"DZD\",\"Name\":\"Algeria Dinar\"},{\"Reference\":\"CYEWYUWI\",\"Code\":\"AOA\",\"Name\":\"Angola Kwanza\"},{\"Reference\":\"E4DK5OJ8\",\"Code\":\"ARS\",\"Name\":\"Argentina Peso\"},{\"Reference\":\"E8CCV66L\",\"Code\":\"AMD\",\"Name\":\"Armenia Dram\"},{\"Reference\":\"14VFJFWA\",\"Code\":\"AWG\",\"Name\":\"Aruba Guilder\"},{\"Reference\":\"P89E3N82\",\"Code\":\"AUD\",\"Name\":\"Australia Dollar\"},{\"Reference\":\"M95CEFXX\",\"Code\":\"AZN\",\"Name\":\"Azerbaijan Manat\"},{\"Reference\":\"VSVCGJ6J\",\"Code\":\"BSD\",\"Name\":\"Bahamas Dollar\"},{\"Reference\":\"1LS6SMLA\",\"Code\":\"BHD\",\"Name\":\"Bahrain Dinar\"},{\"Reference\":\"NAUIST7H\",\"Code\":\"BDT\",\"Name\":\"Bangladesh Taka\"},{\"Reference\":\"27T5T57Q\",\"Code\":\"BBD\",\"Name\":\"Barbados Dollar\"},{\"Reference\":\"7C77TSEX\",\"Code\":\"BYN\",\"Name\":\"Belarus Ruble\"},{\"Reference\":\"REDUTIN9\",\"Code\":\"BZD\",\"Name\":\"Belize Dollar\"},{\"Reference\":\"EEJIQ0NR\",\"Code\":\"BMD\",\"Name\":\"Bermuda Dollar\"},{\"Reference\":\"Y337VVLT\",\"Code\":\"BTN\",\"Name\":\"Bhutan Ngultrum\"},{\"Reference\":\"ZCU1XMWP\",\"Code\":\"BOB\",\"Name\":\"Bolivia Bol?viano\"},{\"Reference\":\"BRFF5TGU\",\"Code\":\"BAM\",\"Name\":\"Bosnia and Herzegovina Convertible Marka\"},{\"Reference\":\"E5AMKPRU\",\"Code\":\"BWP\",\"Name\":\"Botswana Pula\"},{\"Reference\":\"UYN5A9W1\",\"Code\":\"BRL\",\"Name\":\"Brazil Real\"},{\"Reference\":\"5938TGMM\",\"Code\":\"BND\",\"Name\":\"Brunei Darussalam Dollar\"},{\"Reference\":\"8VTNRHZF\",\"Code\":\"BGN\",\"Name\":\"Bulgaria Lev\"},{\"Reference\":\"PRNCTN0H\",\"Code\":\"BIF\",\"Name\":\"Burundi Franc\"},{\"Reference\":\"EXNEJHE5\",\"Code\":\"KHR\",\"Name\":\"Cambodia Riel\"},{\"Reference\":\"OTIVPVJ5\",\"Code\":\"CAD\",\"Name\":\"Canada Dollar\"},{\"Reference\":\"UTGO275U\",\"Code\":\"CVE\",\"Name\":\"Cape Verde Escudo\"},{\"Reference\":\"A429GQP2\",\"Code\":\"KYD\",\"Name\":\"Cayman Islands Dollar\"},{\"Reference\":\"JJHKIOK9\",\"Code\":\"CLP\",\"Name\":\"Chile Peso\"},{\"Reference\":\"HHTU58PG\",\"Code\":\"CNY\",\"Name\":\"China Yuan Renminbi\"},{\"Reference\":\"EM2835KC\",\"Code\":\"COP\",\"Name\":\"Colombia Peso\"},{\"Reference\":\"BGLVISGB\",\"Code\":\"XOF\",\"Name\":\"Communaut? Financi?re Africaine (BCEAO)\"},{\"Reference\":\"4SV7HHLK\",\"Code\":\"XAF\",\"Name\":\"Communaut? Financi?re Africaine (BEAC)\"},{\"Reference\":\"KQZJ8Y8P\",\"Code\":\"KMF\",\"Name\":\"Comorian Franc\"},{\"Reference\":\"3UC8INA9\",\"Code\":\"XPF\",\"Name\":\"Comptoirs Fran?ais du Pacifique (CFP)\"},{\"Reference\":\"WSZW7130\",\"Code\":\"CDF\",\"Name\":\"Congo/Kinshasa Franc\"},{\"Reference\":\"TK3SAAIS\",\"Code\":\"CRC\",\"Name\":\"Costa Rica Colon\"},{\"Reference\":\"LVXB1P7I\",\"Code\":\"HRK\",\"Name\":\"Croatia Kuna\"},{\"Reference\":\"54ES1412\",\"Code\":\"CUC\",\"Name\":\"Cuba Convertible Peso\"},{\"Reference\":\"904YESK7\",\"Code\":\"CUP\",\"Name\":\"Cuba Peso\"},{\"Reference\":\"61JYWPGP\",\"Code\":\"CZK\",\"Name\":\"Czech Republic Koruna\"},{\"Reference\":\"AIXUAZM7\",\"Code\":\"DKK\",\"Name\":\"Denmark Krone\"},{\"Reference\":\"177ECVI6\",\"Code\":\"DJF\",\"Name\":\"Djibouti Franc\"},{\"Reference\":\"X1ZNE06G\",\"Code\":\"DOP\",\"Name\":\"Dominican Republic Peso\"},{\"Reference\":\"AZFUD7A8\",\"Code\":\"XCD\",\"Name\":\"East Caribbean Dollar\"},{\"Reference\":\"GRHG2UDM\",\"Code\":\"EGP\",\"Name\":\"Egypt Pound\"},{\"Reference\":\"QYZVBR0W\",\"Code\":\"SVC\",\"Name\":\"El Salvador Colon\"},{\"Reference\":\"VKOSH2JU\",\"Code\":\"ERN\",\"Name\":\"Eritrea Nakfa\"},{\"Reference\":\"HI558J1G\",\"Code\":\"ETB\",\"Name\":\"Ethiopia Birr\"},{\"Reference\":\"00000000\",\"Code\":\"EUR\",\"Name\":\"Euro Member Countries\"},{\"Reference\":\"5TFYHHQP\",\"Code\":\"FKP\",\"Name\":\"Falkland Islands (Malvinas) Pound\"},{\"Reference\":\"99L3QUVI\",\"Code\":\"FJD\",\"Name\":\"Fiji Dollar\"},{\"Reference\":\"WJ7DPVDQ\",\"Code\":\"GMD\",\"Name\":\"Gambia Dalasi\"},{\"Reference\":\"JOX1O5AA\",\"Code\":\"GEL\",\"Name\":\"Georgia Lari\"},{\"Reference\":\"FVJE0U1K\",\"Code\":\"GHS\",\"Name\":\"Ghana Cedi\"},{\"Reference\":\"FO23ZWL7\",\"Code\":\"GIP\",\"Name\":\"Gibraltar Pound\"},{\"Reference\":\"CHQ8CP0M\",\"Code\":\"GTQ\",\"Name\":\"Guatemala Quetzal\"},{\"Reference\":\"UG3SZ4U5\",\"Code\":\"GGP\",\"Name\":\"Guernsey Pound\"},{\"Reference\":\"9AUFU8BO\",\"Code\":\"GNF\",\"Name\":\"Guinea Franc\"},{\"Reference\":\"D0GT1IDC\",\"Code\":\"GYD\",\"Name\":\"Guyana Dollar\"},{\"Reference\":\"FROLSOGY\",\"Code\":\"HTG\",\"Name\":\"Haiti Gourde\"},{\"Reference\":\"J6MZHZDW\",\"Code\":\"HNL\",\"Name\":\"Honduras Lempira\"},{\"Reference\":\"VQF2GWC4\",\"Code\":\"HKD\",\"Name\":\"Hong Kong Dollar\"},{\"Reference\":\"MCXZQNDI\",\"Code\":\"HUF\",\"Name\":\"Hungary Forint\"},{\"Reference\":\"GDZVSY97\",\"Code\":\"ISK\",\"Name\":\"Iceland Krona\"},{\"Reference\":\"T8BSZWFG\",\"Code\":\"INR\",\"Name\":\"India Rupee\"},{\"Reference\":\"Q5O4Z93Y\",\"Code\":\"IDR\",\"Name\":\"Indonesia Rupiah\"},{\"Reference\":\"EHSROQ0F\",\"Code\":\"XDR\",\"Name\":\"International Monetary Fund (IMF)\"},{\"Reference\":\"DA94VPI6\",\"Code\":\"IRR\",\"Name\":\"Iran Rial\"},{\"Reference\":\"WGD4DDYX\",\"Code\":\"IQD\",\"Name\":\"Iraq Dinar\"},{\"Reference\":\"CSW4PESM\",\"Code\":\"IMP\",\"Name\":\"Isle of Man Pound\"},{\"Reference\":\"LVNDY93V\",\"Code\":\"ILS\",\"Name\":\"Israel Shekel\"},{\"Reference\":\"6EZYF3SD\",\"Code\":\"JMD\",\"Name\":\"Jamaica Dollar\"},{\"Reference\":\"JYDZ9K0H\",\"Code\":\"JPY\",\"Name\":\"Japan Yen\"},{\"Reference\":\"CNUEH3KH\",\"Code\":\"JEP\",\"Name\":\"Jersey Pound\"},{\"Reference\":\"G1A94HY0\",\"Code\":\"JOD\",\"Name\":\"Jordan Dinar\"},{\"Reference\":\"04X2GJFK\",\"Code\":\"KZT\",\"Name\":\"Kazakhstan Tenge\"},{\"Reference\":\"1YZYIANP\",\"Code\":\"KES\",\"Name\":\"Kenya Shilling\"},{\"Reference\":\"HXT0PJEK\",\"Code\":\"KPW\",\"Name\":\"Korea (North) Won\"},{\"Reference\":\"FZHIV93U\",\"Code\":\"KRW\",\"Name\":\"Korea (South) Won\"},{\"Reference\":\"H9F0Y1FL\",\"Code\":\"KWD\",\"Name\":\"Kuwait Dinar\"},{\"Reference\":\"HT1AEKNZ\",\"Code\":\"KGS\",\"Name\":\"Kyrgyzstan Som\"},{\"Reference\":\"34P4S95X\",\"Code\":\"LAK\",\"Name\":\"Laos Kip\"},{\"Reference\":\"TFD91I3Q\",\"Code\":\"LBP\",\"Name\":\"Lebanon Pound\"},{\"Reference\":\"Z9WG8XEQ\",\"Code\":\"LSL\",\"Name\":\"Lesotho Loti\"},{\"Reference\":\"2IFLH5BG\",\"Code\":\"LRD\",\"Name\":\"Liberia Dollar\"},{\"Reference\":\"UHP6YCFK\",\"Code\":\"LYD\",\"Name\":\"Libya Dinar\"},{\"Reference\":\"C60ZZT9F\",\"Code\":\"MOP\",\"Name\":\"Macau Pataca\"},{\"Reference\":\"AMJE2KA2\",\"Code\":\"MKD\",\"Name\":\"Macedonia Denar\"},{\"Reference\":\"MEYBGCUA\",\"Code\":\"MGA\",\"Name\":\"Madagascar Ariary\"},{\"Reference\":\"SX89YJ5Q\",\"Code\":\"MWK\",\"Name\":\"Malawi Kwacha\"},{\"Reference\":\"AVPHFCVB\",\"Code\":\"MYR\",\"Name\":\"Malaysia Ringgit\"},{\"Reference\":\"7V40APTA\",\"Code\":\"MVR\",\"Name\":\"Maldives (Maldive Islands) Rufiyaa\"},{\"Reference\":\"V6PE44TC\",\"Code\":\"MRO\",\"Name\":\"Mauritania Ouguiya\"},{\"Reference\":\"5FQMRA3Z\",\"Code\":\"MUR\",\"Name\":\"Mauritius Rupee\"},{\"Reference\":\"HFMIC3QZ\",\"Code\":\"MXN\",\"Name\":\"Mexico Peso\"},{\"Reference\":\"F9V9DITW\",\"Code\":\"MDL\",\"Name\":\"Moldova Leu\"},{\"Reference\":\"OH005D34\",\"Code\":\"MNT\",\"Name\":\"Mongolia Tughrik\"},{\"Reference\":\"968IUZ04\",\"Code\":\"MAD\",\"Name\":\"Morocco Dirham\"},{\"Reference\":\"06R7HL9C\",\"Code\":\"MZN\",\"Name\":\"Mozambique Metical\"},{\"Reference\":\"OHEBNFQC\",\"Code\":\"MMK\",\"Name\":\"Myanmar (Burma) Kyat\"},{\"Reference\":\"OCMB3BSH\",\"Code\":\"NAD\",\"Name\":\"Namibia Dollar\"},{\"Reference\":\"MHCV086C\",\"Code\":\"NPR\",\"Name\":\"Nepal Rupee\"},{\"Reference\":\"XY44YK4P\",\"Code\":\"ANG\",\"Name\":\"Netherlands Antilles Guilder\"},{\"Reference\":\"9QHCLOMR\",\"Code\":\"NZD\",\"Name\":\"New Zealand Dollar\"},{\"Reference\":\"8CGA1ZBR\",\"Code\":\"NIO\",\"Name\":\"Nicaragua Cordoba\"},{\"Reference\":\"J1YITB71\",\"Code\":\"NGN\",\"Name\":\"Nigeria Naira\"},{\"Reference\":\"YY9BHF7D\",\"Code\":\"NOK\",\"Name\":\"Norway Krone\"},{\"Reference\":\"G9USH50Y\",\"Code\":\"OMR\",\"Name\":\"Oman Rial\"},{\"Reference\":\"CAZTHD32\",\"Code\":\"PKR\",\"Name\":\"Pakistan Rupee\"},{\"Reference\":\"3WEBVIRJ\",\"Code\":\"PAB\",\"Name\":\"Panama Balboa\"},{\"Reference\":\"PLYILSHM\",\"Code\":\"PGK\",\"Name\":\"Papua New Guinea Kina\"},{\"Reference\":\"9ANSGLU2\",\"Code\":\"PYG\",\"Name\":\"Paraguay Guarani\"},{\"Reference\":\"VA5QX4IF\",\"Code\":\"PEN\",\"Name\":\"Peru Sol\"},{\"Reference\":\"XINHE8YB\",\"Code\":\"PHP\",\"Name\":\"Philippines Peso\"},{\"Reference\":\"ZSDDWA9K\",\"Code\":\"PLN\",\"Name\":\"Poland Zloty\"},{\"Reference\":\"QH02R8ZQ\",\"Code\":\"QAR\",\"Name\":\"Qatar Riyal\"},{\"Reference\":\"D5UA3SV8\",\"Code\":\"RON\",\"Name\":\"Romania Leu\"},{\"Reference\":\"LNNXEP7S\",\"Code\":\"RUB\",\"Name\":\"Russia Ruble\"},{\"Reference\":\"1DUC60LA\",\"Code\":\"RWF\",\"Name\":\"Rwanda Franc\"},{\"Reference\":\"8Q31KGCO\",\"Code\":\"STD\",\"Name\":\"S?o Tom? and Pr?ncipe Dobra\"},{\"Reference\":\"CZ6QIV8L\",\"Code\":\"SHP\",\"Name\":\"Saint Helena Pound\"},{\"Reference\":\"XMARG4MG\",\"Code\":\"WST\",\"Name\":\"Samoa Tala\"},{\"Reference\":\"OVUEUSSI\",\"Code\":\"SAR\",\"Name\":\"Saudi Arabia Riyal\"},{\"Reference\":\"XSIQTZXM\",\"Code\":\"RSD\",\"Name\":\"Serbia Dinar\"},{\"Reference\":\"3RDFOSMM\",\"Code\":\"SCR\",\"Name\":\"Seychelles Rupee\"},{\"Reference\":\"9QEGOOOH\",\"Code\":\"SLL\",\"Name\":\"Sierra Leone Leone\"},{\"Reference\":\"TCRM7ZGI\",\"Code\":\"SGD\",\"Name\":\"Singapore Dollar\"},{\"Reference\":\"2QQ3OMU5\",\"Code\":\"SBD\",\"Name\":\"Solomon Islands Dollar\"},{\"Reference\":\"6T8HJJCG\",\"Code\":\"SOS\",\"Name\":\"Somalia Shilling\"},{\"Reference\":\"SCY4SUG4\",\"Code\":\"ZAR\",\"Name\":\"South Africa Rand\"},{\"Reference\":\"04281QBW\",\"Code\":\"LKR\",\"Name\":\"Sri Lanka Rupee\"},{\"Reference\":\"Z9CIJUGF\",\"Code\":\"SDG\",\"Name\":\"Sudan Pound\"},{\"Reference\":\"PKOQROC1\",\"Code\":\"SRD\",\"Name\":\"Suriname Dollar\"},{\"Reference\":\"LOIZXJGA\",\"Code\":\"SZL\",\"Name\":\"Swaziland Lilangeni\"},{\"Reference\":\"IR469N0J\",\"Code\":\"SEK\",\"Name\":\"Sweden Krona\"},{\"Reference\":\"LU8FEFMA\",\"Code\":\"CHF\",\"Name\":\"Switzerland Franc\"},{\"Reference\":\"FMEVYNSI\",\"Code\":\"SYP\",\"Name\":\"Syria Pound\"},{\"Reference\":\"J778YI8V\",\"Code\":\"TWD\",\"Name\":\"Taiwan New Dollar\"},{\"Reference\":\"HHA6WMHL\",\"Code\":\"TJS\",\"Name\":\"Tajikistan Somoni\"},{\"Reference\":\"DAKAOMA0\",\"Code\":\"TZS\",\"Name\":\"Tanzania Shilling\"},{\"Reference\":\"HPSKUY8T\",\"Code\":\"THB\",\"Name\":\"Thailand Baht\"},{\"Reference\":\"F6LINXBY\",\"Code\":\"TOP\",\"Name\":\"Tonga Pa'anga\"},{\"Reference\":\"WYPYYDBG\",\"Code\":\"TTD\",\"Name\":\"Trinidad and Tobago Dollar\"},{\"Reference\":\"VOJLY8QK\",\"Code\":\"TND\",\"Name\":\"Tunisia Dinar\"},{\"Reference\":\"XQFE3015\",\"Code\":\"TRY\",\"Name\":\"Turkey Lira\"},{\"Reference\":\"YLS4MASZ\",\"Code\":\"TMT\",\"Name\":\"Turkmenistan Manat\"},{\"Reference\":\"8H1MAKFN\",\"Code\":\"TVD\",\"Name\":\"Tuvalu Dollar\"},{\"Reference\":\"QOXVDZ3S\",\"Code\":\"UGX\",\"Name\":\"Uganda Shilling\"},{\"Reference\":\"EX8EQ23U\",\"Code\":\"UAH\",\"Name\":\"Ukraine Hryvnia\"},{\"Reference\":\"DM8PJ33P\",\"Code\":\"GBP\",\"Name\":\"United Kingdom Pound\"},{\"Reference\":\"00000001\",\"Code\":\"USD\",\"Name\":\"United States Dollar\"},{\"Reference\":\"8T34I0KJ\",\"Code\":\"UYU\",\"Name\":\"Uruguay Peso\"},{\"Reference\":\"9V63WQ4D\",\"Code\":\"UZS\",\"Name\":\"Uzbekistan Som\"},{\"Reference\":\"LD7F66TV\",\"Code\":\"VUV\",\"Name\":\"Vanuatu Vatu\"},{\"Reference\":\"Y439HWRQ\",\"Code\":\"VEF\",\"Name\":\"Venezuela Bol?var\"},{\"Reference\":\"SX7TAGWM\",\"Code\":\"VND\",\"Name\":\"Viet Nam Dong\"},{\"Reference\":\"FHO1GB1X\",\"Code\":\"YER\",\"Name\":\"Yemen Rial\"},{\"Reference\":\"DIV3O40Q\",\"Code\":\"ZMW\",\"Name\":\"Zambia Kwacha\"},{\"Reference\":\"0MH4MZAS\",\"Code\":\"ZWD\",\"Name\":\"Zimbabwe Dollar\"}]" - } - ] - } - ] - }, - { - "name": "Users", - "description": "", - "item": [ - { - "name": "Get Users", - "event": [ - { - "listen": "test", - "script": { - "id": "dc685b0e-933c-4e93-b00c-2ce0a19752fe", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"There is more than 5 results\", function(){", - " pm.expect(responseData.length).to.above(4);", - "});", - "", - "var subsidiaryAdminLogin = pm.environment.get('User')", - "var subsAdmin = _.filter(responseData,{'Login':subsidiaryAdminLogin})", - "", - "pm.test(\"User '\"+subsidiaryAdminLogin+\"' is present\", function(){", - " pm.expect(subsAdmin.length).to.be.equal(1);", - "})", - "", - "pm.test (\"Data for user '\"+subsidiaryAdminLogin+\"' are correct\", function(){", - " pm.expect(subsAdmin[0].Reference).to.be.equal(pm.environment.get('UserRef'));", - " pm.expect(subsAdmin[0].LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", - " pm.expect(subsAdmin[0].FirstName).to.be.equal('Utilisateur');", - " pm.expect(subsAdmin[0].TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", - " pm.expect(subsAdmin[0].IsActive).to.be.equal(true);", - " pm.expect(subsAdmin[0].DefaultSubsidiaryReference).to.be.equal(pm.environment.get('CurrentSubsidiary'));", - " ", - " ", - "})" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/users", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "users" - ] - }, - "description": "Get list of user" - }, - "response": [] - }, - { - "name": "Get User", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "93d1b92f-1d91-408f-b132-0c75d99da37a", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "16d6bcb3-f95c-4e86-bdea-6b1c3771c6b7", - "type": "text/javascript", - "exec": [ - "var moment = require ('moment')", - "", - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"Data of user with ref '\"+pm.environment.get('UserRef')+\"' are correct\", function () {", - " pm.expect (responseData.Reference).to.be.eql(pm.environment.get('UserRef'));", - " pm.expect(responseData.TenantReference).to.be.equals(pm.environment.get('CurrentTenant'));", - " pm.expect(responseData.DefaultSubsidiaryReference).to.be.equals(pm.environment.get('CurrentSubsidiary'));", - " pm.expect(responseData.Login).to.be.equals(pm.environment.get('User'));", - " pm.expect(responseData.FirstName).to.be.equals(\"Utilisateur\");", - " pm.expect(responseData.LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", - " pm.expect(responseData.Phone).to.be.equals(\"+33(0)1-02-03-04-05\");", - " pm.expect(responseData.EmailAddress).to.be.equals(\"s.carecolin@astonitf.com\");", - " pm.expect(responseData.Language).to.be.equals(\"FR\");", - " pm.expect(responseData.Function).to.be.equals(\"Président Directeur Général\");", - " pm.expect(responseData.TimeZone).to.be.equals(\"UTC+1\");", - " var m = moment(responseData.LastConnection);", - " pm.expect(m.isValid()).to.be.equals(true);", - " pm.expect(responseData.UserSubsidiaries.length).to.be.equals(3);", - " pm.expect(responseData.Permissions.length).to.be.above(15);", - " pm.expect(responseData.Permissions[0]).to.have.all.keys([\"Code\",\"Type\",\"Value\",\"Priority\",\"RoleReference\"]);", - "});", - "", - "", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/users/:userID", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "users", - ":userID" - ], - "variable": [ - { - "key": "userID", - "value": "{{UserRef}}", - "description": "Id of the user" - } - ] - }, - "description": "Verification du EndPoint Users" - }, - "response": [] - }, - { - "name": "Get user Token", - "event": [ - { - "listen": "test", - "script": { - "id": "bc7958c9-e773-4141-a2d7-5a1d1c170301", - "type": "text/javascript", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "" - ] - } - }, - { - "listen": "prerequest", - "script": { - "id": "0f7a638d-253d-43de-baad-42809fb0983b", - "type": "text/javascript", - "exec": [ - "var loginPostData = {", - " \"Login\": pm.environment.get('User'),", - " \"Password\": pm.environment.get('Password')", - "};", - "", - "pm.globals.set (\"LoginPostData\", JSON.stringify(loginPostData))" - ] - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{{LoginPostData}}" - }, - "url": { - "raw": "{{CoreURL}}/api/configuration/users/Tokens", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "users", - "Tokens" - ] - } - }, - "response": [] - }, - { - "name": "Get users for a subsidiary", - "event": [ - { - "listen": "test", - "script": { - "id": "754ce822-2ae6-45f8-8af1-11bd34e8ea6f", - "type": "text/javascript", - "exec": [ - "var responseData= JSON.parse(responseBody)", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"There is more than on result\", function(){", - " pm.expect(responseData.length).to.be.above(0)", - "})", - "", - "pm.test(\"Data for user '\"+pm.environment.get('User')+\"' are correct\",function(){", - " var currentAdmin= _.filter(responseData,{'Login':pm.environment.get('User')})", - " pm.expect (currentAdmin.length).to.be.equal(1);", - " pm.expect (currentAdmin[0].Reference).to.be.equal(pm.environment.get('UserRef'));", - " pm.expect (currentAdmin[0].LastName).to.contain('Tenant',pm.environment.get('CurrentTenant'));", - " pm.expect (currentAdmin[0].FirstName).to.be.equal('Utilisateur');", - " pm.expect (currentAdmin[0].TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", - " pm.expect (currentAdmin[0].IsActive).to.be.equal(true);", - " pm.expect (currentAdmin[0].DefaultSubsidiaryReference).to.be.equal(pm.environment.get('CurrentSubsidiary'));", - "})", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference/users", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "subsidiaries", - ":subsidiaryReference", - "users" - ], - "variable": [ - { - "key": "subsidiaryReference", - "value": "{{CurrentSubsidiary}}" - } - ] - }, - "description": "Get list of authorised user for a given subsidiary" - }, - "response": [] - } - ] - }, - { - "name": "Functions", - "description": "", - "item": [ - { - "name": "Get Functions", - "event": [ - { - "listen": "test", - "script": { - "id": "9f268bb8-b61d-41d7-b6b3-47ac20406abc", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"There is 32 results\", function(){", - " pm.expect(responseData.length).to.be.equals(32);", - "})", - "", - "pm.test(\"Function 'Chargé de clientèle' is present\", function(){", - " pm.expect(_.filter(responseData,{'Name':'Chargé de clientèle'}).length).to.be.equal(1)", - "})" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/functions", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "functions" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Tenants", - "description": "", - "item": [ - { - "name": "Errors", - "description": "", - "item": [], - "_postman_isSubFolder": true - }, - { - "name": "Create Tenant", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d6eaa875-19b8-4235-a662-1e7957e23c41", - "type": "text/javascript", - "exec": [ - "var newTenantName= 'API Test Tenant-'+Date.now();", - "", - "var tenantData =", - "{", - " \"Name\":newTenantName,", - " \"CurrencyReference\": \"00000000\",", - " \"IsActive\": true,", - " \"TenantAgingBalanceSlices\": [", - " {", - " \"TenantAgingBalanceSliceReference\": null,", - " \"LowValue\": 0,", - " \"HighValue\": 30", - " },", - " {", - " \"TenantAgingBalanceSliceReference\": null,", - " \"LowValue\": 30,", - " \"HighValue\": 60", - " }", - " ]", - "};", - "", - "pm.globals.set(\"NewTenantData\",JSON.stringify(tenantData));" - ] - } - }, - { - "listen": "test", - "script": { - "id": "19bcdf50-17a6-443a-a351-6e5c033f9e99", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.globals.set('NewTenantRef', responseData.Reference);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"New Tenant informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", - " // TODO verify all fields....", - " pm.expect(responseData.Name).to.be.equal(postedData.Name);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", - " pm.expect(responseData.TenantAgingBalanceSlices).to.be.eql(postedData.TenantAgingBalanceSlices);", - "});" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{{NewTenantData}}" - }, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants" - ] - } - }, - "response": [] - }, - { - "name": "Get Tenants", - "event": [ - { - "listen": "test", - "script": { - "id": "734519ac-fe32-45f7-92ec-fa002e2773fc", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"There is more than one subsidiary in the list\",function(){", - " pm.expect(responseData.length).to.be.above(0);", - "});", - "", - "var newTenant = _.filter (responseData,{'Reference':pm.globals.get(\"NewTenantRef\")});", - "", - "pm.test(\"There is newly created tenant in the list\",function(){", - " pm.expect(newTenant.length).to.be.equal(1);", - "});", - "", - "pm.test(\"Returned data are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", - " //TODO change reponseDate by newTenant. ..", - " pm.expect(newTenant[0].Code).not.to.be.equal(null);", - " pm.expect(newTenant[0].Name).to.be.equal(postedData.Name);", - " pm.expect(newTenant[0].IsActive).to.be.equal(postedData.IsActive);", - " pm.expect(newTenant[0].StatusLabel).to.be.equal(\"Actif\");", - " pm.expect(newTenant[0].CountOfSubsidiaries).to.be.equal(0);", - "});" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants" - ] - } - }, - "response": [] - }, - { - "name": "Get Tenant", - "event": [ - { - "listen": "test", - "script": { - "id": "9229a172-351f-4660-95d0-8dc9c4da9c43", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test(\"New Tenant informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('NewTenantData'));", - " pm.expect(responseData.Name).to.be.equal(postedData.Name);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", - " pm.expect(responseData.TenantAgingBalanceSlices).to.be.eql(postedData.TenantAgingBalanceSlices);", - "});", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json, text/json, application/xml, text/xml" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants/:TenantReference", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants", - ":TenantReference" - ], - "variable": [ - { - "key": "TenantReference", - "value": "{{NewTenantRef}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Update Tenant", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "6d517337-5330-4bdf-a470-e5882f6455c9", - "type": "text/javascript", - "exec": [ - "var updatedTenantName= 'API Test Tenant UDPATED'+Date.now();", - "pm.globals.set(\"updateTenantName\",updatedTenantName)", - "", - "var tenantUpdatedData =", - "{", - " \"Name\":updatedTenantName,", - " \"CurrencyReference\": \"00000000\",", - " \"IsActive\": false", - "};", - "", - "pm.globals.set(\"UpdatedTenantData\",JSON.stringify(tenantUpdatedData));" - ] - } - }, - { - "listen": "test", - "script": { - "id": "88d4504c-8f8a-4444-9dcb-af3508b1a242", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Updated subsidiary informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('UpdatedTenantData'));", - " pm.expect(responseData.Reference).to.be.equal(pm.globals.get('NewTenantRef'));", - " pm.expect(responseData.Name).to.be.equal(postedData.Name);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", - "});", - "", - "" - ] - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{{UpdatedTenantData}}" - }, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants/:tenantReference", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants", - ":tenantReference" - ], - "variable": [ - { - "key": "tenantReference", - "value": "{{NewTenantRef}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Get Tenant Subsidiaries", - "event": [ - { - "listen": "test", - "script": { - "id": "1d2c443f-8e94-4995-878a-14bc5395712f", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Number of elements is 0\", function(){", - " pm.expect(responseData.length).to.be.equals(0);", - "});", - "", - "// var specificSubs = _.filter(responseData,{'CompanyName':'Altaven-F1'});", - "", - "// pm.test(\"Results contains Altaven-F1\", function(){", - "// pm.expect(specificSubs.length).to.be.equal(1,'Filiale non trouvée');", - "// });", - "", - "// pm.test(\"Data for subsidiary 'Altaven-F1' are correct\", function(){", - "// pm.expect(specificSubs[0].Code).to.be.equal('9L6BW89EA6');", - "// pm.expect(specificSubs[0].IsActive).to.be.equal(true,'Statut incorrect');", - "// pm.expect(specificSubs[0].AttachedPortfoliosCount).to.be.equal(3, 'Nombre de filiale incorrecte');", - "// pm.expect(specificSubs[0].CurrencyCode).to.be.equal('EUR','Devise incorrecte');", - "// pm.expect(specificSubs[0].AttachedPortfolios.length).to.be.equal(3, 'Nombre de filiale incorrecte');", - "// });" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json, text/json, application/xml, text/xml" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants/:reference/subsidiaries", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants", - ":reference", - "subsidiaries" - ], - "variable": [ - { - "key": "reference", - "value": "{{NewTenantRef}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Subsidiaries", - "description": "", - "item": [ - { - "name": "Create Subsidiary", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "ec4e11a0-0a47-43ed-ae71-29cec1af3a2a", - "type": "text/javascript", - "exec": [ - "moment = require(\"moment\");", - "", - "var now =Date.now();", - "var signatureDate = moment(now).toISOString();", - "var openingDate = moment(now).add(1,'months').toISOString();", - "var newSubsidiaryName= \"Sté&Co-\"+now;", - " ", - "var subsidiaryData =", - "{", - " \"TenantReference\":pm.environment.get(\"CurrentTenant\"),", - " \"IsActive\": true,", - " \"CompanyName\":\"Sté&Co-\"+now,", - " \"TradeName\": \"societe\"+now,", - " \"LegalFormReference\": \"0FSXMQN3\",", - " \"IdType\": 0,", - " \"LegalId\": \"118956211\",", - " \"Nic\": \"\",", - " \"VatNumber\": \"FR52324598\",", - " \"Capital\": 500000.00,", - " \"CurrencyReference\": \"00000000\",", - " \"Address1\": \"16 place\",", - " \"Address2\": \"de la carriere\",", - " \"Address3\": \"\",", - " \"ZipCode\": \"5400\",", - " \"City\": \"NancY\",", - " \"CountryReference\": \"EUFRANCE\",", - " \"Phone\": \"+33(0)1-02-03-04-05\",", - " \"Language\": \"FR\",", - " \"ContractSignatureDate\": signatureDate,", - " \"ContractNumber\": \"123-ABC999\",", - " \"OpeningDate\": openingDate,", - " \"FiscalPeriodType\": 10,", - " \"FiscalPeriodStart\": \"01/01\",", - " \"FiscalPeriodEnd\": \"31/12\"", - "}", - "pm.globals.set(\"NewSubsidiaryData\",JSON.stringify(subsidiaryData));" - ] - } - }, - { - "listen": "test", - "script": { - "id": "49876b70-7846-4c0e-8df0-c4aeaf6eaa32", - "type": "text/javascript", - "exec": [ - "var moment= require('moment')", - "var responseData = JSON.parse(responseBody);", - "", - "pm.globals.set('NewSubsidiaryRef', responseData.Reference);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"New subsidiary informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", - " pm.expect(responseData.TenantReference).to.be.equal(postedData.TenantReference);", - " pm.expect(responseData.IsActive).to.be.equal(true);", - " pm.expect(responseData.Code).not.to.be.equal(null);", - " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", - " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", - " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", - " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", - " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", - " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", - " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", - " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.Adress1).to.be.equal(postedData.Adress1);", - " pm.expect(responseData.Adress2).to.be.equal(postedData.Adress2);", - " pm.expect(responseData.Adress3).to.be.equal(postedData.Adress3);", - " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", - " pm.expect(responseData.City).to.be.equal(postedData.City);", - " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", - " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", - " pm.expect(responseData.Language).to.be.equal(postedData.Language);", - " var m1 = moment(responseData.ContractSignatureDate);", - " pm.expect(m1.isValid()).to.be.equals(true);", - "", - " var m2 = moment(responseData.OpeningDate);", - " pm.expect(m2.isValid()).to.be.equals(true);", - " //Ensure diff between date is 1 month", - " //FIXME : not working !", - " //pm.expect(moment.duration(m1.diff(m2,'month'))).to.be.equal(1);", - " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", - " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", - " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", - " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", - "});", - "" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - }, - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{{NewSubsidiaryData}}" - }, - "url": { - "raw": "{{CoreURL}}/api/configuration/subsidiaries", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "subsidiaries" - ] - } - }, - "response": [] - }, - { - "name": "Get Subsidiary", - "event": [ - { - "listen": "test", - "script": { - "id": "8fe7302d-b225-4b09-9201-96818d236898", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody)", - "var moment= require('moment')", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"New subsidiary informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", - " pm.expect(responseData.TenantReference).to.be.equal(postedData.TenantReference);", - " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", - " pm.expect(responseData.Code).not.to.be.equal(null);", - " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", - " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", - " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", - " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", - " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", - " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", - " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", - " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.Address1).to.be.equal(postedData.Address1);", - " pm.expect(responseData.Address2).to.be.equal(postedData.Address2);", - " pm.expect(responseData.Address3).to.be.equal(postedData.Address3);", - " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", - " pm.expect(responseData.City).to.be.equal(postedData.City);", - " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", - " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", - " pm.expect(responseData.Language).to.be.equal(postedData.Language);", - " var m1 = moment(responseData.ContractSignatureDate);", - " pm.expect(m1.isValid()).to.be.equals(true);", - " var m2 = moment(responseData.OpeningDate);", - " pm.expect(m2.isValid()).to.be.equals(true);", - " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", - " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", - " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", - " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", - "});", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "subsidiaries", - ":subsidiaryReference" - ], - "variable": [ - { - "key": "subsidiaryReference", - "value": "{{NewSubsidiaryRef}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Get Tenant Subsidiaries", - "event": [ - { - "listen": "test", - "script": { - "id": "abd5d399-2462-4812-bf7e-4a32a871a767", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "var moment = require('moment');", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test (\"There is at least 4 results\", function(){", - " pm.expect (responseData.length).to.be.above(3);", - "})", - "", - "var postedData= JSON.parse(pm.globals.get('NewSubsidiaryData'));", - "var specificSubs = _.filter(responseData,{'Reference':pm.globals.get('NewSubsidiaryRef')});", - "", - "pm.test(\"Results contains subsidiary '\"+postedData.CompanyName+\"'\", function(){", - " pm.expect(specificSubs.length).to.be.equal(1);", - "});", - "", - "", - "pm.test(\"Data for subsidiary '\"+postedData.CompanyName+\"' are correct\", function(){", - " var postedData = JSON.parse (pm.globals.get('NewSubsidiaryData'));", - " pm.expect(specificSubs[0].Code).not.to.be.equal(null);", - " pm.expect(specificSubs[0].CompanyName).to.be.equal(postedData.CompanyName);", - " pm.expect(specificSubs[0].IsActive).to.be.equal(postedData.IsActive);", - " var m1 = moment(specificSubs[0].CreationDate);", - " pm.expect(m1.isValid()).to.be.equals(true);", - " pm.expect(specificSubs[0].CurrencyCode).to.be.equal(\"EUR\");", - " pm.expect(specificSubs[0].IsDunningModuleActived).to.be.equal(false);", - " pm.expect(specificSubs[0].IsCreditInsuranceModuleActived).to.be.equal(false);", - " pm.expect(specificSubs[0].IsFactoringModuleActived).to.be.equal(false);", - " pm.expect(specificSubs[0].AttachedPortfoliosCount).to.be.equal(0);", - " pm.expect(specificSubs[0].AttachedPortfolios).to.be.eql(null);", - "});" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json, text/json, application/xml, text/xml", - "disabled": true - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/tenants/:reference/subsidiaries", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "tenants", - ":reference", - "subsidiaries" - ], - "variable": [ - { - "key": "reference", - "value": "{{CurrentTenant}}" - } - ] - }, - "description": "Ensure newly create subsidiary is linked to tenants" - }, - "response": [] - }, - { - "name": "Update Subsidiary", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f52bd56c-5712-4261-9104-8e591a21bc9e", - "type": "text/javascript", - "exec": [ - "var now =Date.now();", - "", - "var newCieName = \"MyNewCompanie\"+now;", - "var newTradeName = \"Société \"+now;", - "", - "var subsidiaryUpdatedData =", - "{ ", - " \"TenantReference\":pm.environment.get(\"CurrentTenant\"),", - " \"IsActive\": true,", - " \"Code\": \"RSEGQ5WUYC\",", - " \"CompanyName\": newCieName,", - " \"TradeName\": newTradeName,", - " \"LegalFormReference\": \"QZKRXJPA\",", - " \"IdType\": 1,", - " \"LegalId\": \"118156478\",", - " \"Nic\": \"027\",", - " \"VatNumber\": \"FR52525252\",", - " \"Capital\": 50000.00,", - " \"CurrencyReference\": \"DM8PJ33P\",", - " \"Address1\": \"16 place\",", - " \"Address2\": \"de la carrière\",", - " \"Address3\": \"complement adresse 3 \",", - " \"ZipCode\": \"54000\",", - " \"City\": \"NancY\",", - " \"CountryReference\": \"EUFRANCE\",", - " \"Phone\": \"+33(0)1-02-03-04-05\",", - " \"Language\": \"FR\",", - " \"ContractSignatureDate\": \"2018-04-18T11:51:46.618\",", - " \"OpeningDate\": \"2018-05-18T11:51:46.618\",", - " \"ContractNumber\": \"AAA89-AAZZ\",", - " \"FiscalPeriodType\": 10,", - " \"FiscalPeriodStart\": \"01/01\",", - " \"FiscalPeriodEnd\": \"31/12\"", - "}", - "pm.globals.set(\"UpdatedSubsidiaryData\",JSON.stringify(subsidiaryUpdatedData));" - ] - } - }, - { - "listen": "test", - "script": { - "id": "28f8237e-daad-40ae-9f2e-8dc561c166db", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "var moment= require('moment')", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Updated subsidiary informations are sent\",function(){", - " pm.expect(responseData).to.be.an('object');", - "});", - "", - "pm.test(\"Informations sent back are correct\",function(){", - " var postedData = JSON.parse (pm.globals.get('UpdatedSubsidiaryData'));", - " //TODO verify all fields....", - " pm.expect(responseData.Reference).to.be.equal(pm.globals.get('NewSubsidiaryRef'));", - " pm.expect(responseData.TenantReference).to.be.equal(pm.environment.get('CurrentTenant'));", - " pm.expect(responseData.IsActive).to.be.equal(postedData.IsActive);", - " pm.expect(responseData.Code).not.to.be.equal(null);", - " pm.expect(responseData.CompanyName).to.be.equal(postedData.CompanyName);", - " pm.expect(responseData.TradeName).to.be.equal(postedData.TradeName);", - " pm.expect(responseData.LegalFormReference).to.be.equal(postedData.LegalFormReference);", - " pm.expect(responseData.IdType).to.be.equal(postedData.IdType);", - " pm.expect(responseData.LegalId).to.be.equal(postedData.LegalId);", - " pm.expect(responseData.Nic).to.be.equal(postedData.Nic);", - " pm.expect(responseData.VatNumber).to.be.equal(postedData.VatNumber);", - " pm.expect(responseData.Capital).to.be.equal(postedData.Capital);", - " pm.expect(responseData.CurrencyReference).to.be.equal(postedData.CurrencyReference);", - " pm.expect(responseData.Address1).to.be.equal(postedData.Address1);", - " pm.expect(responseData.Address2).to.be.equal(postedData.Address2);", - " pm.expect(responseData.Address3).to.be.equal(postedData.Address3);", - " pm.expect(responseData.ZipCode).to.be.equal(postedData.ZipCode);", - " pm.expect(responseData.City).to.be.equal(postedData.City);", - " pm.expect(responseData.CountryReference).to.be.equal(postedData.CountryReference);", - " pm.expect(responseData.Phone).to.be.equal(postedData.Phone);", - " pm.expect(responseData.Language).to.be.equal(postedData.Language);", - " pm.expect(responseData.ContractSignatureDate).to.be.equal(postedData.ContractSignatureDate);", - " var m1 = moment(responseData.ContractSignatureDate);", - " pm.expect(m1.isValid()).to.be.equals(true);", - " pm.expect(responseData.OpeningDate).to.be.equal(postedData.OpeningDate);", - " var m2 = moment(responseData.OpeningDate);", - " pm.expect(m2.isValid()).to.be.equals(true);", - " pm.expect(responseData.ContractNumber).to.be.equal(postedData.ContractNumber);", - " pm.expect(responseData.OpeningDate).to.be.equal(postedData.OpeningDate);", - " pm.expect(responseData.FiscalPeriodType).to.be.equal(postedData.FiscalPeriodType);", - " pm.expect(responseData.FiscalPeriodStart).to.be.equal(postedData.FiscalPeriodStart);", - " pm.expect(responseData.FiscalPeriodEnd).to.be.equal(postedData.FiscalPeriodEnd);", - "});", - "" - ] - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{{UpdatedSubsidiaryData}}" - }, - "url": { - "raw": "{{CoreURL}}/api/configuration/subsidiaries/:subsidiaryReference", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "subsidiaries", - ":subsidiaryReference" - ], - "variable": [ - { - "key": "subsidiaryReference", - "value": "{{NewSubsidiaryRef}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Get User Subsidiaries", - "event": [ - { - "listen": "test", - "script": { - "id": "e6f51aae-5a62-45c6-820b-0e99634e27f5", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse (responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Number of elements is 3\", function(){", - " pm.expect(responseData.length).to.be.equals(3);", - "})", - "", - "", - "var expectedSubs =[\"S21-TestBack\",\"S22-TestBack\",\"S23-TestBack\"];", - "_.each (expectedSubs, function (sub){", - " isPresent =_.filter (responseData,{\"CompanyName\":sub});", - " pm.test(\"Results contains correct subsidiary \"+ sub, function(){", - " pm.expect(isPresent.length).to.be.equal(1);", - " ", - " });", - "});", - "", - " ", - "", - "" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - }, - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/users/:userReference/subsidiaries", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "users", - ":userReference", - "subsidiaries" - ], - "variable": [ - { - "key": "userReference", - "value": "{{UserRef}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Language", - "description": "", - "item": [ - { - "name": "Get Translations", - "event": [ - { - "listen": "test", - "script": { - "id": "83736688-2d37-49ac-82a7-20cb7ba17d7c", - "type": "text/javascript", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"There is some results\", function(){", - " pm.expect(responseBody.length).to.be.above(0);", - "})", - "", - "" - ] - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json, text/json, application/xml, text/xml" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/translations/:language", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "translations", - ":language" - ], - "variable": [ - { - "key": "language", - "value": "FR" - } - ] - } - }, - "response": [] - }, - { - "name": "Get Supported Languages", - "event": [ - { - "listen": "test", - "script": { - "id": "fd8e5421-896a-4472-a1ee-08988edb52ee", - "type": "text/javascript", - "exec": [ - "", - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "pm.test(\"Number of elements is 2\", function(){", - " pm.expect(responseData.length).to.be.equals(2);", - "});", - "", - "pm.test(\"Results contains correct data for FR language\", function(){", - " var FR = _.filter (responseData,{Code:'FR'});", - " pm.expect(FR[0].Code).to.be.equals('FR');", - " pm.expect(FR[0].EnglishDescription).to.be.equals('French');", - " pm.expect(FR[0].LocaleDescription).to.be.equals('Français');", - "});", - "" - ] - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json, text/json, application/xml, text/xml" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/translations/SupportedLanguages", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "translations", - "SupportedLanguages" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "848466c0-082f-4f9f-8df3-2def1e58bf60", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "3d21f020-0144-4a4e-b876-2f6294c7a50a", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Country", - "description": "", - "item": [ - { - "name": "Get Countries", - "event": [ - { - "listen": "test", - "script": { - "id": "42b9639c-ac8e-414e-a855-17430caf34d2", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse (responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "", - "pm.test (\"There is 250 results\", function(){", - " pm.expect(responseData.length).to.be.equal(250);", - "})", - "", - "pm.test(\"Data for country 'FRANCE' are present and correct\",function(){", - " var france = _.filter(responseData, {'Reference':'EUFRANCE'});", - " console.log(france);", - " pm.expect(france.length).to.be.equal(1);", - " pm.expect(france[0].Code).to.be.equal('FRA');", - " pm.expect(france[0].CodeIso2).to.be.equal('FR');", - " pm.expect(france[0].Name).to.be.equal('France');", - "})" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentSubsidiary", - "value": "{{CurrentSubsidiary}}" - }, - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/countries", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "countries" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "LegalForms", - "description": "", - "item": [ - { - "name": "Get legalForms", - "event": [ - { - "listen": "test", - "script": { - "id": "ccb61788-121e-4034-b020-c5698177ed8e", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test (\"There is 5 results\", function(){", - " pm.expect(responseData.length).to.be.equal(5);", - "});", - "", - "pm.test(\"All legal form are returned\", function(){", - " var legalForms = ['Autre forme juridique','Société à responsabilité limitée','Société anonyme','Société par actions simplifiée','Société par actions simplifiée unipersonnelle'];", - " _.each(legalForms, function(legalform) {", - " var current = _.filter(responseData, {'Name':legalform});", - " pm.expect(current.length).to.be.equal(1);", - " });", - "});" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/legalForms", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "legalForms" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "26235f19-c0e1-4326-a860-5b3f7b967816", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "1c90e60d-d768-469b-87fa-8ee6fae4abe2", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Enums", - "description": "", - "item": [ - { - "name": "Get FiscalPeriod", - "event": [ - { - "listen": "test", - "script": { - "id": "064dd5f6-e4e7-475b-89b8-d69b681bdbfd", - "type": "text/javascript", - "exec": [ - "var responseData = JSON.parse(responseBody);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test (\"Data are correct\",function(){", - " var expected ={", - " \"10\": \"Année civile\",", - " \"20\": \"Autre période\"", - "};", - "pm.expect(responseData).to.be.eql(expected)", - " ", - "})" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "CurrentLanguage", - "value": "fr" - } - ], - "body": {}, - "url": { - "raw": "{{CoreURL}}/api/configuration/enums/FiscalPeriods", - "host": [ - "{{CoreURL}}" - ], - "path": [ - "api", - "configuration", - "enums", - "FiscalPeriods" - ] - } - }, - "response": [] - } - ] } ], "auth": { From a81e3b34430b65d42184a5a1925102d5d7e4383f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Dec 2018 21:27:56 +0100 Subject: [PATCH 3/8] enableDebug --- .gitignore | 4 ++- .taskkey | 2 +- NewmanPostman/newmantask.js | 1 + NewmanPostman/npm-debug.log | 48 ++++++++++++++++++++++++++++++++++ Tests/TestSuite.js | 2 ++ Tests/TestSuite.ts | 1 + Tests/customReporterTest.js | 1 + Tests/emptyCollectionTest.js | 1 + Tests/emptyContents.js | 1 + Tests/folderTest.js | 1 + Tests/globalVarFileTest.js | 1 + Tests/globalVarTest.js | 1 + Tests/numberOfIterationTest.js | 1 + tsconfig.json | 1 + 14 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 NewmanPostman/npm-debug.log diff --git a/.gitignore b/.gitignore index 0a75127..56da602 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,6 @@ bld/ */dist/ node_modules .vscode -*.vsix \ No newline at end of file +*.vsix +*.map +*.js \ No newline at end of file diff --git a/.taskkey b/.taskkey index 92c83c2..900c839 100644 --- a/.taskkey +++ b/.taskkey @@ -1 +1 @@ -189f410b-3d17-4d7e-b0b7-9e96f2ad1af4 \ No newline at end of file +6bec57d3-21ab-4491-95b6-97967b95b4c7 \ No newline at end of file diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index e52fd69..2eeb192 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -137,3 +137,4 @@ function run() { }); } run(); +//# sourceMappingURL=newmantask.js.map \ No newline at end of file diff --git a/NewmanPostman/npm-debug.log b/NewmanPostman/npm-debug.log new file mode 100644 index 0000000..d5cabdd --- /dev/null +++ b/NewmanPostman/npm-debug.log @@ -0,0 +1,48 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', +1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', +1 verbose cli 'run', +1 verbose cli 'test' ] +2 info using npm@3.10.10 +3 info using node@v7.2.1 +4 verbose run-script [ 'pretest', 'test', 'posttest' ] +5 info lifecycle task@1.0.0~pretest: task@1.0.0 +6 silly lifecycle task@1.0.0~pretest: no script for pretest, continuing +7 info lifecycle task@1.0.0~test: task@1.0.0 +8 verbose lifecycle task@1.0.0~test: unsafe-perm in lifecycle true +9 verbose lifecycle task@1.0.0~test: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;F:\DocSéb\NewmanPostman_VSTS_Task\NewmanPostman\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Java\jdk1.8.0_45\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;E:\wamp\bin\php\php5.5.12;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\;C:\WINDOWS\System32\OpenSSH\;E:\wamp\bin\php\php5.6.35;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Microsoft VS Code\bin;C:\Applications\Atlassian\atlassian-plugin-sdk-6.1.0\bin;C:\Users\seb\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Arduino\hardware\tools\avr\bin;C:\Users\seb\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Users\seb\AppData\Roaming\Composer\vendor\bin;C:\SysGCC\esp8266\bin +10 verbose lifecycle task@1.0.0~test: CWD: F:\DocSéb\NewmanPostman_VSTS_Task\NewmanPostman +11 silly lifecycle task@1.0.0~test: Args: [ '/d /s /c', 'echo "Error: no test specified" && exit 1' ] +12 silly lifecycle task@1.0.0~test: Returned: code: 1 signal: null +13 info lifecycle task@1.0.0~test: Failed to exec test script +14 verbose stack Error: task@1.0.0 test: `echo "Error: no test specified" && exit 1` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) +14 verbose stack at emitTwo (events.js:106:13) +14 verbose stack at EventEmitter.emit (events.js:191:7) +14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) +14 verbose stack at emitTwo (events.js:106:13) +14 verbose stack at ChildProcess.emit (events.js:191:7) +14 verbose stack at maybeClose (internal/child_process.js:885:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) +15 verbose pkgid task@1.0.0 +16 verbose cwd F:\DocSéb\NewmanPostman_VSTS_Task\NewmanPostman +17 error Windows_NT 10.0.17134 +18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test" +19 error node v7.2.1 +20 error npm v3.10.10 +21 error code ELIFECYCLE +22 error task@1.0.0 test: `echo "Error: no test specified" && exit 1` +22 error Exit status 1 +23 error Failed at the task@1.0.0 test script 'echo "Error: no test specified" && exit 1'. +23 error Make sure you have the latest version of node.js and npm installed. +23 error If you do, this is most likely a problem with the task package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error echo "Error: no test specified" && exit 1 +23 error You can get information on how to open an issue for this project with: +23 error npm bugs task +23 error Or if that isn't available, you can get their info via: +23 error npm owner ls task +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] diff --git a/Tests/TestSuite.js b/Tests/TestSuite.js index 2d1170a..fedd8e7 100644 --- a/Tests/TestSuite.js +++ b/Tests/TestSuite.js @@ -19,6 +19,7 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyContents.js'); let runner = new mocktest.MockTestRunner(testPath); runner.run(); + console.error(runner.stdout); assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); done(); }); @@ -70,3 +71,4 @@ describe('Other arguments', function () { done(); }); }); +//# sourceMappingURL=TestSuite.js.map \ No newline at end of file diff --git a/Tests/TestSuite.ts b/Tests/TestSuite.ts index 836662f..f90e225 100644 --- a/Tests/TestSuite.ts +++ b/Tests/TestSuite.ts @@ -20,6 +20,7 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyContents.js'); let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); runner.run(); + console.error(runner.stdout); assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); done(); }); diff --git a/Tests/customReporterTest.js b/Tests/customReporterTest.js index ec655b2..f0230b8 100644 --- a/Tests/customReporterTest.js +++ b/Tests/customReporterTest.js @@ -23,3 +23,4 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=customReporterTest.js.map \ No newline at end of file diff --git a/Tests/emptyCollectionTest.js b/Tests/emptyCollectionTest.js index 1ae2823..8e718e9 100644 --- a/Tests/emptyCollectionTest.js +++ b/Tests/emptyCollectionTest.js @@ -21,3 +21,4 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=emptyCollectionTest.js.map \ No newline at end of file diff --git a/Tests/emptyContents.js b/Tests/emptyContents.js index d078c98..89e035b 100644 --- a/Tests/emptyContents.js +++ b/Tests/emptyContents.js @@ -30,3 +30,4 @@ runner.registerMockExport('stats', (itemPath) => { } }); runner.run(); +//# sourceMappingURL=emptyContents.js.map \ No newline at end of file diff --git a/Tests/folderTest.js b/Tests/folderTest.js index 0dbf00b..a3c8cb4 100644 --- a/Tests/folderTest.js +++ b/Tests/folderTest.js @@ -23,3 +23,4 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=folderTest.js.map \ No newline at end of file diff --git a/Tests/globalVarFileTest.js b/Tests/globalVarFileTest.js index faa3588..03eb989 100644 --- a/Tests/globalVarFileTest.js +++ b/Tests/globalVarFileTest.js @@ -25,3 +25,4 @@ answers.stats[filePath] = true; answers.checkPath[globalVariables] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=globalVarFileTest.js.map \ No newline at end of file diff --git a/Tests/globalVarTest.js b/Tests/globalVarTest.js index 8b0a1b6..3c009f4 100644 --- a/Tests/globalVarTest.js +++ b/Tests/globalVarTest.js @@ -24,3 +24,4 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=globalVarTest.js.map \ No newline at end of file diff --git a/Tests/numberOfIterationTest.js b/Tests/numberOfIterationTest.js index 325e555..2f4c847 100644 --- a/Tests/numberOfIterationTest.js +++ b/Tests/numberOfIterationTest.js @@ -23,3 +23,4 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); +//# sourceMappingURL=numberOfIterationTest.js.map \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index e58f785..fdde581 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target": "ES6", + "sourceMap": true, "module": "commonjs" }, "exclude": [ From 8c81ec015255ee198547491fa0ae7d8c23f7d7f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 Dec 2018 18:56:03 +0100 Subject: [PATCH 4/8] SupportURL for collection and envt --- NewmanPostman/newmantask.js | 86 ++++++++++++++++++++++++------------- NewmanPostman/newmantask.ts | 79 +++++++++++++++++++++------------- NewmanPostman/package.json | 3 +- NewmanPostman/task.json | 59 +++++++++++++++++++------ 4 files changed, 154 insertions(+), 73 deletions(-) diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index f281000..3568536 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -9,12 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); -const tl = require("vsts-task-lib"); +const tl = require("vsts-task-lib/task"); +const isurl = require("is-url"); function GetToolRunner(collectionToRun) { - tl.debug("in GetToolRunner"); let pathToNewman = tl.getInput('pathToNewman', false); - tl.debug("Path to newman is : " + pathToNewman); - if (pathToNewman.length == 0) { + if (typeof pathToNewman != 'undefined' && pathToNewman) { + console.info("Specific path to newman found"); + } + else { + console.info("No specific path to newman, using default of 'newman'"); pathToNewman = "newman"; } var newman = tl.tool(tl.which(pathToNewman, true)); @@ -85,42 +88,65 @@ function GetToolRunner(collectionToRun) { newman.argIf(tl.filePathSupplied('exportGlobals'), ['--export-globals', exportGlobals]); let exportCollection = tl.getPathInput('exportCollection'); newman.argIf(tl.filePathSupplied('exportCollection'), ['--export-collection', exportCollection]); - newman.arg(['-e', tl.getPathInput('environment', true, true)]); + if (tl.getInput('environmentSourceType') == 'file') { + newman.arg(['-e', tl.getPathInput('environmentFile', true, true)]); + } + else { + let envURl = tl.getInput('environmentUrl', true); + if (isurl(envURl)) { + newman.arg(['-e', envURl]); + } + else { + tl.setResult(tl.TaskResult.Failed, 'Provided string "' + envURl + '" for environment is not a valid url'); + } + } return newman; } function run() { return __awaiter(this, void 0, void 0, function* () { try { - tl.debug('executing newman'); - tl.setResourcePath(path.join(__dirname, './../task.json')); - let collectionFileSource = tl.getPathInput('collectionFileSource', true, true); - var taskSuccess = true; - if (tl.stats(collectionFileSource).isDirectory()) { - let contents = tl.getDelimitedInput('Contents', '\n', true); - collectionFileSource = path.normalize(collectionFileSource); - let allPaths = tl.find(collectionFileSource); - let matchedPaths = tl.match(allPaths, contents, collectionFileSource); - let matchedFiles = matchedPaths.filter((itemPath) => !tl.stats(itemPath).isDirectory()); - console.log("found %d files", matchedFiles.length); - if (matchedFiles.length > 0) { - matchedFiles.forEach((file) => { - var newman = GetToolRunner(file); - var execResponse = newman.execSync(); - tl.debug(execResponse.stdout); - if (execResponse.code === 1) { - console.log(execResponse); - taskSuccess = false; - } - }); + // tl.debug('executing newman') + tl.setResourcePath(path.join(__dirname, 'task.json')); + if (tl.getInput('collectionSourceType', true) == 'file') { + let collectionFileSource = tl.getPathInput('collectionFileSource', true, true); + var taskSuccess = true; + if (tl.stats(collectionFileSource).isDirectory()) { + let contents = tl.getDelimitedInput('Contents', '\n', true); + collectionFileSource = path.normalize(collectionFileSource); + let allPaths = tl.find(collectionFileSource); + let matchedPaths = tl.match(allPaths, contents, collectionFileSource); + let matchedFiles = matchedPaths.filter((itemPath) => !tl.stats(itemPath).isDirectory()); + console.log("found %d files", matchedFiles.length); + if (matchedFiles.length > 0) { + matchedFiles.forEach((file) => { + var newman = GetToolRunner(file); + var execResponse = newman.execSync(); + // tl.debug(execResponse.stdout); + if (execResponse.code === 1) { + console.log(execResponse); + taskSuccess = false; + } + }); + } + else { + console.log("Could not find any collection files in the path provided"); + taskSuccess = false; + } } else { - console.log("Could not find any collection files in the path provided"); - taskSuccess = false; + var newman = GetToolRunner(collectionFileSource); + yield newman.exec(); } } else { - var newman = GetToolRunner(collectionFileSource); - yield newman.exec(); + let collectionFileUrl = tl.getInput('collectionURL', true); + if (isurl(collectionFileUrl)) { + var newman = GetToolRunner(collectionFileUrl); + yield newman.exec(); + } + else { + tl.setResult(tl.TaskResult.Failed, 'Provided string "' + collectionFileUrl + '" for collection is not a valid url'); + } } if (taskSuccess) { tl.setResult(tl.TaskResult.Succeeded, "Success"); diff --git a/NewmanPostman/newmantask.ts b/NewmanPostman/newmantask.ts index 15fff40..8612e7c 100644 --- a/NewmanPostman/newmantask.ts +++ b/NewmanPostman/newmantask.ts @@ -1,6 +1,7 @@ import path = require('path'); import tl = require('vsts-task-lib/task'); import trm = require('vsts-task-lib/toolrunner'); +import isurl = require('is-url'); function GetToolRunner(collectionToRun: string) { let pathToNewman = tl.getInput('pathToNewman', false); @@ -89,7 +90,16 @@ function GetToolRunner(collectionToRun: string) { let exportCollection = tl.getPathInput('exportCollection'); newman.argIf(tl.filePathSupplied('exportCollection'), ['--export-collection', exportCollection]); - newman.arg(['-e', tl.getPathInput('environment', true, true)]); + if (tl.getInput('environmentSourceType') == 'file') { //environment is a file + newman.arg(['-e', tl.getPathInput('environmentFile', true, true)]); + } else { + let envURl = tl.getInput('environmentUrl', true); + if (isurl(envURl)) { + newman.arg(['-e', envURl]); + } else { + tl.setResult(tl.TaskResult.Failed, 'Provided string "' + envURl + '" for environment is not a valid url'); + } + } return newman; } @@ -98,39 +108,48 @@ async function run() { // tl.debug('executing newman') tl.setResourcePath(path.join(__dirname, 'task.json')); - let collectionFileSource = tl.getPathInput('collectionFileSource', true, true); - var taskSuccess = true; - if (tl.stats(collectionFileSource).isDirectory()) { - let contents: string[] = tl.getDelimitedInput('Contents', '\n', true); - collectionFileSource = path.normalize(collectionFileSource); - - let allPaths: string[] = tl.find(collectionFileSource); - let matchedPaths: string[] = tl.match(allPaths, contents, collectionFileSource); - let matchedFiles: string[] = matchedPaths.filter((itemPath: string) => !tl.stats(itemPath).isDirectory()); - - console.log("found %d files", matchedFiles.length); - - if (matchedFiles.length > 0) { - matchedFiles.forEach((file: string) => { - var newman: trm.ToolRunner = GetToolRunner(file); - var execResponse = newman.execSync(); - // tl.debug(execResponse.stdout); - if (execResponse.code === 1) { - console.log(execResponse); - taskSuccess = false; - } - }); + if (tl.getInput('collectionSourceType', true) == 'file') { + let collectionFileSource = tl.getPathInput('collectionFileSource', true, true); + var taskSuccess = true; + if (tl.stats(collectionFileSource).isDirectory()) { + let contents: string[] = tl.getDelimitedInput('Contents', '\n', true); + collectionFileSource = path.normalize(collectionFileSource); + + let allPaths: string[] = tl.find(collectionFileSource); + let matchedPaths: string[] = tl.match(allPaths, contents, collectionFileSource); + let matchedFiles: string[] = matchedPaths.filter((itemPath: string) => !tl.stats(itemPath).isDirectory()); + + console.log("found %d files", matchedFiles.length); + + if (matchedFiles.length > 0) { + matchedFiles.forEach((file: string) => { + var newman: trm.ToolRunner = GetToolRunner(file); + var execResponse = newman.execSync(); + // tl.debug(execResponse.stdout); + if (execResponse.code === 1) { + console.log(execResponse); + taskSuccess = false; + } + }); + } + else { + console.log("Could not find any collection files in the path provided"); + taskSuccess = false; + } } else { - console.log("Could not find any collection files in the path provided"); - taskSuccess = false; + var newman: trm.ToolRunner = GetToolRunner(collectionFileSource); + await newman.exec(); + } + } else { + let collectionFileUrl = tl.getInput('collectionURL', true); + if (isurl(collectionFileUrl)) { + var newman: trm.ToolRunner = GetToolRunner(collectionFileUrl); + await newman.exec(); + } else { + tl.setResult(tl.TaskResult.Failed, 'Provided string "' + collectionFileUrl + '" for collection is not a valid url'); } } - else { - var newman: trm.ToolRunner = GetToolRunner(collectionFileSource); - await newman.exec(); - } - if (taskSuccess) { tl.setResult(tl.TaskResult.Succeeded, "Success"); } diff --git a/NewmanPostman/package.json b/NewmanPostman/package.json index a2fa6c0..2b8ed75 100644 --- a/NewmanPostman/package.json +++ b/NewmanPostman/package.json @@ -12,6 +12,7 @@ }, "devDependencies": { "@types/node": "^8.0.7", - "@types/q": "1.0.2" + "@types/q": "1.0.2", + "is-url": "^1.2.4" } } diff --git a/NewmanPostman/task.json b/NewmanPostman/task.json index 3d686aa..ab071bb 100644 --- a/NewmanPostman/task.json +++ b/NewmanPostman/task.json @@ -16,8 +16,7 @@ "Patch": 21 }, "demands": [], - "groups": [ - { + "groups": [{ "name": "requestOptions", "displayName": "Request Options", "isExpanded": true @@ -48,24 +47,41 @@ "isExpanded": false } ], - "inputs": [ - { + "inputs": [{ + "name": "collectionSourceType", + "type": "radio", + "defaultValue": "file", + "required": true, + "options": { + "file": "File(s)", + "url": "Url" + } + }, { "name": "collectionFileSource", "type": "filePath", "label": "Collection File Source", "defaultValue": "", - "required": true, - "helpMarkDown": "Path to the folder containing collection file source(s)" + "required": false, + "helpMarkDown": "Path to the folder containing collection file source(s)", + "visibleRule": "collectionSourceType = file" }, { "name": "Contents", "type": "multiLine", "label": "Contents", "defaultValue": "**/collection.json", - "required": true, - "helpMarkDown": "File paths to include as part of the collection run. Supports multiple lines of match patterns." + "required": false, + "helpMarkDown": "File paths to include as part of the collection run. Supports multiple lines of match patterns.", + "visibleRule": "collectionSourceType = file" }, { + "name": "collectionURL", + "type": "string", + "defaultValue": "http://", + "required": false, + "helpMarkDown": "Url to shared collection", + "visibleRule": "collectionSourceType = url" + }, { "name": "folder", "type": "string", "label": "Folder", @@ -74,12 +90,31 @@ "helpMarkDown": "Run requests within a particular folder in a collection" }, { - "name": "environment", + "name": "environmentSourceType", + "type": "radio", + "defaultValue": "file", + "options": { + "file": "File", + "url": "Url" + } + }, + { + "name": "environmentFile", "type": "filePath", - "label": "Environment", + "label": "Environment File", "defaultValue": "", - "required": true, - "helpMarkDown": "Path to the Postman environment file as JSON" + "required": false, + "helpMarkDown": "Path to the Postman environment file as JSON", + "visibleRule": "environmentSourceType = file" + }, + { + "name": "environmentUrl", + "type": "string", + "label": "Environment Url", + "defaultValue": "", + "required": false, + "helpMarkDown": "URL to the Postman environment file as JSON", + "visibleRule": "environmentSourceType = url" }, { "name": "globalVariables", From a3f9fd4e1604a8982808ce451b1e54f7bdf87cb2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 Dec 2018 21:19:18 +0100 Subject: [PATCH 5/8] supportURL and associated test --- .taskkey | 2 +- NewmanPostman/newmantask.js | 11 ++++- NewmanPostman/newmantask.ts | 10 +++- NewmanPostman/task.json | 12 +++-- Tests/TestSuite.js | 82 ++++++++++++++++++++++++++++++-- Tests/TestSuite.ts | 85 +++++++++++++++++++++++++++++++--- Tests/customReporterTest.js | 4 +- Tests/customReporterTest.ts | 14 +++--- Tests/emptyCollectionTest.js | 1 + Tests/emptyCollectionTest.ts | 1 + Tests/emptyContents.js | 1 + Tests/emptyContents.ts | 1 + Tests/emptyEnvironmentFile.ts | 27 +++++++++++ Tests/emptyEnvironmentURL.ts | 27 +++++++++++ Tests/folderTest.js | 4 +- Tests/folderTest.ts | 4 +- Tests/globalVarFileTest.js | 4 +- Tests/globalVarFileTest.ts | 5 +- Tests/globalVarTest.js | 4 +- Tests/globalVarTest.ts | 5 +- Tests/noEnvironment.ts | 27 +++++++++++ Tests/numberOfIterationTest.js | 4 +- Tests/numberOfIterationTest.ts | 4 +- Tests/useCollectionURL.ts | 28 +++++++++++ Tests/useEnvironmentFile.ts | 34 ++++++++++++++ Tests/useEnvironmentURL.ts | 29 ++++++++++++ Tests/wrongCollectionURL.ts | 28 +++++++++++ Tests/wrongEnvironmentURL.ts | 28 +++++++++++ 28 files changed, 449 insertions(+), 37 deletions(-) create mode 100644 Tests/emptyEnvironmentFile.ts create mode 100644 Tests/emptyEnvironmentURL.ts create mode 100644 Tests/noEnvironment.ts create mode 100644 Tests/useCollectionURL.ts create mode 100644 Tests/useEnvironmentFile.ts create mode 100644 Tests/useEnvironmentURL.ts create mode 100644 Tests/wrongCollectionURL.ts create mode 100644 Tests/wrongEnvironmentURL.ts diff --git a/.taskkey b/.taskkey index 900c839..2f0d4dd 100644 --- a/.taskkey +++ b/.taskkey @@ -1 +1 @@ -6bec57d3-21ab-4491-95b6-97967b95b4c7 \ No newline at end of file +a5e231a5-35e1-425a-b6aa-f1b68a86532e \ No newline at end of file diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index b2264cb..3909a85 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -88,18 +88,25 @@ function GetToolRunner(collectionToRun) { newman.argIf(tl.filePathSupplied('exportGlobals'), ['--export-globals', exportGlobals]); let exportCollection = tl.getPathInput('exportCollection'); newman.argIf(tl.filePathSupplied('exportCollection'), ['--export-collection', exportCollection]); - if (tl.getInput('environmentSourceType') == 'file') { + let envType = tl.getInput('environmentSourceType'); + if (envType == 'file') { + console.info("File used for environment"); newman.arg(['-e', tl.getPathInput('environmentFile', true, true)]); } - else { + else if (envType == 'url') { let envURl = tl.getInput('environmentUrl', true); if (isurl(envURl)) { + console.info("URL used for environment"); newman.arg(['-e', envURl]); } else { tl.setResult(tl.TaskResult.Failed, 'Provided string "' + envURl + '" for environment is not a valid url'); } } + else { + //no environement used. Don't add argument, just log info. + console.info('No environment set, no need to add it in argument'); + } return newman; } function run() { diff --git a/NewmanPostman/newmantask.ts b/NewmanPostman/newmantask.ts index 8612e7c..f0b252c 100644 --- a/NewmanPostman/newmantask.ts +++ b/NewmanPostman/newmantask.ts @@ -90,15 +90,21 @@ function GetToolRunner(collectionToRun: string) { let exportCollection = tl.getPathInput('exportCollection'); newman.argIf(tl.filePathSupplied('exportCollection'), ['--export-collection', exportCollection]); - if (tl.getInput('environmentSourceType') == 'file') { //environment is a file + let envType = tl.getInput('environmentSourceType'); + if (envType == 'file') { //environment is a file + console.info("File used for environment"); newman.arg(['-e', tl.getPathInput('environmentFile', true, true)]); - } else { + } else if (envType == 'url') { let envURl = tl.getInput('environmentUrl', true); if (isurl(envURl)) { + console.info("URL used for environment"); newman.arg(['-e', envURl]); } else { tl.setResult(tl.TaskResult.Failed, 'Provided string "' + envURl + '" for environment is not a valid url'); } + } else { + //no environement used. Don't add argument, just log info. + console.info('No environment set, no need to add it in argument'); } return newman; } diff --git a/NewmanPostman/task.json b/NewmanPostman/task.json index ab071bb..c0be923 100644 --- a/NewmanPostman/task.json +++ b/NewmanPostman/task.json @@ -55,7 +55,8 @@ "options": { "file": "File(s)", "url": "Url" - } + }, + "helpMarkDown": "Specify either to use file(s) as collection or url (eg : shared collections)" }, { "name": "collectionFileSource", "type": "filePath", @@ -93,10 +94,13 @@ "name": "environmentSourceType", "type": "radio", "defaultValue": "file", + "required": false, "options": { "file": "File", - "url": "Url" - } + "url": "Url", + "none": "None" + }, + "helpMarkDown": "Specify either to use file(s), url (eg : shared environment) or nothing as environment" }, { "name": "environmentFile", @@ -111,7 +115,7 @@ "name": "environmentUrl", "type": "string", "label": "Environment Url", - "defaultValue": "", + "defaultValue": "http://", "required": false, "helpMarkDown": "URL to the Postman environment file as JSON", "visibleRule": "environmentSourceType = url" diff --git a/Tests/TestSuite.js b/Tests/TestSuite.js index fedd8e7..6afaad1 100644 --- a/Tests/TestSuite.js +++ b/Tests/TestSuite.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const mocktest = require("vsts-task-lib/mock-test"); const path = require("path"); const assert = require("assert"); -describe('Mandatory arguments', function () { +describe('Error handling', function () { before(() => { }); after(() => { }); it('Error if collection file path is empty', (done) => { @@ -11,7 +11,7 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyCollectionTest.js'); let runner = new mocktest.MockTestRunner(testPath); runner.run(); - assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source raise an error'); + assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source should raise an error'); done(); }); it('Error if collection is a directory and content not set', (done) => { @@ -19,14 +19,86 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyContents.js'); let runner = new mocktest.MockTestRunner(testPath); runner.run(); - console.error(runner.stdout); - assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: Contents'), 'Empty content should raise an error if collection is a directory'); + done(); + }); + it('Error if environement is set as a file and none set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyEnvironmentFile.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: environmentFile'), 'Empty environment file should raise an error if envt type is \'file\''); + done(); + }); + it('Error if environement is set as a URL and none set', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyEnvironmentURL.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: environmentUrl'), 'Empty url should raise an error if envt type is \'url\''); + done(); + }); + it('Error if provided environment url is not a valid url', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'wrongEnvironmentURL.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('for environment is not a valid url'), 'Error if environement URL format is incorrect'); + done(); + }); + it('Error if provided collection url is not a valid url', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'wrongCollectionURL.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('for collection is not a valid url'), 'Error if collection URL format is incorrect'); done(); }); }); -describe('Other arguments', function () { +describe('Normal behavior', function () { before(() => { }); after(() => { }); + it('Environment is not mandatory', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'noEnvironment.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('No environment set, no need to add it in argument'), 'No error if no envt is set'); + done(); + }); + it('When environment file is set, it\'s used', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'useEnvironmentFile.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('-e ' + path.join(__dirname, 'assets/Core.postman_collection.json')), 'environment file can be used'); + done(); + }); + it('URL can be set for collection', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'useCollectionURL.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('run https://api.getpostman.com/collections/$collectionUid?apikey=$apiKey'), 'url can be used as collection source'); + done(); + }); + it('URL can be set for environment', (done) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'useEnvironmentURL.js'); + let runner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('-e https://api.getpostman.com/environments?apikey=$apiKey'), 'url can be used as environment source'); + done(); + }); it('Multiple report format can be set', (done) => { this.timeout(1000); let testPath = path.join(__dirname, 'customReporterTest.js'); diff --git a/Tests/TestSuite.ts b/Tests/TestSuite.ts index f90e225..824ccb9 100644 --- a/Tests/TestSuite.ts +++ b/Tests/TestSuite.ts @@ -2,7 +2,7 @@ import * as mocktest from 'vsts-task-lib/mock-test'; import * as path from 'path'; import * as assert from 'assert'; -describe('Mandatory arguments', function () { +describe('Error handling', function () { before(() => { }); after(() => { }); @@ -12,7 +12,7 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyCollectionTest.js'); let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); runner.run(); - assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source raise an error'); + assert(runner.stdOutContained('Input required: collectionFileSource'), 'Empty Collection file source should raise an error'); done(); }); it('Error if collection is a directory and content not set', (done: MochaDone) => { @@ -20,17 +20,89 @@ describe('Mandatory arguments', function () { let testPath = path.join(__dirname, 'emptyContents.js'); let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); runner.run(); - console.error(runner.stdout); - assert(runner.stdOutContained('Input required: Contents'), 'Empty content raise an error if collection is a directory'); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: Contents'), 'Empty content should raise an error if collection is a directory'); + done(); + }); + it('Error if environement is set as a file and none set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyEnvironmentFile.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: environmentFile'), 'Empty environment file should raise an error if envt type is \'file\''); done(); }); + it('Error if environement is set as a URL and none set', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'emptyEnvironmentURL.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('Input required: environmentUrl'), 'Empty url should raise an error if envt type is \'url\''); + done(); + }) + it('Error if provided environment url is not a valid url', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'wrongEnvironmentURL.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('for environment is not a valid url'), 'Error if environement URL format is incorrect'); + done(); + }); + it('Error if provided collection url is not a valid url', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'wrongCollectionURL.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('for collection is not a valid url'), 'Error if collection URL format is incorrect'); + done(); + }) }); -describe('Other arguments', function () { + +describe('Normal behavior', function () { before(() => { }); after(() => { }); - + it('Environment is not mandatory', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'noEnvironment.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('No environment set, no need to add it in argument'), 'No error if no envt is set'); + done(); + }) + it ('When environment file is set, it\'s used', (done:MochaDone)=>{ + this.timeout(1000); + let testPath = path.join(__dirname, 'useEnvironmentFile.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('-e '+path.join(__dirname, 'assets/Core.postman_collection.json')), 'environment file can be used'); + done(); + }); + it('URL can be set for collection', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'useCollectionURL.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('run https://api.getpostman.com/collections/$collectionUid?apikey=$apiKey'), 'url can be used as collection source'); + done(); + }); + it('URL can be set for environment', (done: MochaDone) => { + this.timeout(1000); + let testPath = path.join(__dirname, 'useEnvironmentURL.js'); + let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); + runner.run(); + // console.error(runner.stdout); + assert(runner.stdOutContained('-e https://api.getpostman.com/environments?apikey=$apiKey'), 'url can be used as environment source'); + done(); + }); it('Multiple report format can be set', (done: MochaDone) => { this.timeout(1000); @@ -77,5 +149,6 @@ describe('Other arguments', function () { assert(runner.stdOutContained('--global-var var1=1 --global-var var2=2'), 'multiple variables are set'); done(); }); + }); diff --git a/Tests/customReporterTest.js b/Tests/customReporterTest.js index f0230b8..dad4409 100644 --- a/Tests/customReporterTest.js +++ b/Tests/customReporterTest.js @@ -6,9 +6,11 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput("environment", environment); +runner.setInput("environmentFile", environment); runner.setInput("reporters", 'cli,json'); let answers = { checkPath: {}, diff --git a/Tests/customReporterTest.ts b/Tests/customReporterTest.ts index 7edf0ca..846edcc 100644 --- a/Tests/customReporterTest.ts +++ b/Tests/customReporterTest.ts @@ -3,28 +3,30 @@ import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environment",environment); -runner.setInput("reporters",'cli,json'); +runner.setInput("environmentFile", environment); +runner.setInput("reporters", 'cli,json'); let answers = { checkPath: {}, which: { 'newman': 'newman' }, - stats:{} + stats: {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/emptyCollectionTest.js b/Tests/emptyCollectionTest.js index 8e718e9..4d5b3dd 100644 --- a/Tests/emptyCollectionTest.js +++ b/Tests/emptyCollectionTest.js @@ -7,6 +7,7 @@ console.info(taskPath); let runner = new mockrun.TaskMockRunner(taskPath); let filePath = ''; let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); let answers = { diff --git a/Tests/emptyCollectionTest.ts b/Tests/emptyCollectionTest.ts index 78f44a4..0b4f56f 100644 --- a/Tests/emptyCollectionTest.ts +++ b/Tests/emptyCollectionTest.ts @@ -9,6 +9,7 @@ console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath=''; let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); diff --git a/Tests/emptyContents.js b/Tests/emptyContents.js index 89e035b..0eebed0 100644 --- a/Tests/emptyContents.js +++ b/Tests/emptyContents.js @@ -7,6 +7,7 @@ console.info(taskPath); let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", ''); let answers = { diff --git a/Tests/emptyContents.ts b/Tests/emptyContents.ts index 29d5305..c093c23 100644 --- a/Tests/emptyContents.ts +++ b/Tests/emptyContents.ts @@ -9,6 +9,7 @@ console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents",''); diff --git a/Tests/emptyEnvironmentFile.ts b/Tests/emptyEnvironmentFile.ts new file mode 100644 index 0000000..634e552 --- /dev/null +++ b/Tests/emptyEnvironmentFile.ts @@ -0,0 +1,27 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("environmentSourceType",'file') + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/emptyEnvironmentURL.ts b/Tests/emptyEnvironmentURL.ts new file mode 100644 index 0000000..3a576a2 --- /dev/null +++ b/Tests/emptyEnvironmentURL.ts @@ -0,0 +1,27 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("environmentSourceType",'url') + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/folderTest.js b/Tests/folderTest.js index a3c8cb4..1ecd162 100644 --- a/Tests/folderTest.js +++ b/Tests/folderTest.js @@ -6,9 +6,11 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput("environment", environment); +runner.setInput("environmentFile", environment); runner.setInput("folder", '/'); let answers = { checkPath: {}, diff --git a/Tests/folderTest.ts b/Tests/folderTest.ts index 95e7252..f1c8b9e 100644 --- a/Tests/folderTest.ts +++ b/Tests/folderTest.ts @@ -9,9 +9,11 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("environmentSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environment",environment); +runner.setInput ("environmentFile",environment); runner.setInput("folder",'/'); let answers = { diff --git a/Tests/globalVarFileTest.js b/Tests/globalVarFileTest.js index 03eb989..d1daa4f 100644 --- a/Tests/globalVarFileTest.js +++ b/Tests/globalVarFileTest.js @@ -7,9 +7,11 @@ let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); let globalVariables = __dirname; +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput("environment", environment); +runner.setInput("environmentFile", environment); runner.setInput("globalVariables", globalVariables); let answers = { checkPath: {}, diff --git a/Tests/globalVarFileTest.ts b/Tests/globalVarFileTest.ts index 6bf09b5..97a8e19 100644 --- a/Tests/globalVarFileTest.ts +++ b/Tests/globalVarFileTest.ts @@ -10,10 +10,11 @@ let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); let globalVariables =__dirname; - +runner.setInput("collectionSourceType",'file'); +runner.setInput("environmentSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environment",environment); +runner.setInput ("environmentFile",environment); runner.setInput("globalVariables",globalVariables); let answers = { diff --git a/Tests/globalVarTest.js b/Tests/globalVarTest.js index 3c009f4..527c4ea 100644 --- a/Tests/globalVarTest.js +++ b/Tests/globalVarTest.js @@ -7,9 +7,11 @@ let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); let globalVars = "var1=1\nvar2=2"; +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput("environment", environment); +runner.setInput("environmentFile", environment); runner.setInput("globalVars", globalVars); let answers = { checkPath: {}, diff --git a/Tests/globalVarTest.ts b/Tests/globalVarTest.ts index f85f181..9e21ce3 100644 --- a/Tests/globalVarTest.ts +++ b/Tests/globalVarTest.ts @@ -9,10 +9,11 @@ let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); let globalVars ="var1=1\nvar2=2"; - +runner.setInput("collectionSourceType",'file'); +runner.setInput("environmentSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environment",environment); +runner.setInput ("environmentFile",environment); runner.setInput("globalVars",globalVars); let answers = { diff --git a/Tests/noEnvironment.ts b/Tests/noEnvironment.ts new file mode 100644 index 0000000..18dea01 --- /dev/null +++ b/Tests/noEnvironment.ts @@ -0,0 +1,27 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("environmentSourceType","none") + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/numberOfIterationTest.js b/Tests/numberOfIterationTest.js index 2f4c847..219b6cc 100644 --- a/Tests/numberOfIterationTest.js +++ b/Tests/numberOfIterationTest.js @@ -6,9 +6,11 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput("environment", environment); +runner.setInput("environmentFile", environment); runner.setInput("numberOfIterations", '2'); let answers = { checkPath: {}, diff --git a/Tests/numberOfIterationTest.ts b/Tests/numberOfIterationTest.ts index 99e08b0..77c9404 100644 --- a/Tests/numberOfIterationTest.ts +++ b/Tests/numberOfIterationTest.ts @@ -9,9 +9,11 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("environmentSourceType",'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environment",environment); +runner.setInput ("environmentFile",environment); runner.setInput("numberOfIterations",'2'); let answers = { diff --git a/Tests/useCollectionURL.ts b/Tests/useCollectionURL.ts new file mode 100644 index 0000000..0d893b1 --- /dev/null +++ b/Tests/useCollectionURL.ts @@ -0,0 +1,28 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'url'); +runner.setInput("collectionUrl", "https://api.getpostman.com/collections/$collectionUid?apikey=$apiKey"); +runner.setInput("environmentSourceType",'none'); + + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/useEnvironmentFile.ts b/Tests/useEnvironmentFile.ts new file mode 100644 index 0000000..d60ee10 --- /dev/null +++ b/Tests/useEnvironmentFile.ts @@ -0,0 +1,34 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); + + +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); +let globalVariables =__dirname; +runner.setInput("collectionSourceType",'file'); +runner.setInput("environmentSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("Contents", path.normalize("**/collection.json")); +runner.setInput ("environmentFile",environment); + + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath[environment]=true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +answers.checkPath[globalVariables]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/useEnvironmentURL.ts b/Tests/useEnvironmentURL.ts new file mode 100644 index 0000000..c340b6c --- /dev/null +++ b/Tests/useEnvironmentURL.ts @@ -0,0 +1,29 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("environmentSourceType",'url'); +runner.setInput("environmentUrl","https://api.getpostman.com/environments?apikey=$apiKey") + + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/wrongCollectionURL.ts b/Tests/wrongCollectionURL.ts new file mode 100644 index 0000000..5cfab5d --- /dev/null +++ b/Tests/wrongCollectionURL.ts @@ -0,0 +1,28 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'url'); +runner.setInput("collectionUrl", "http://"); +runner.setInput("environmentSourceType",'none'); + + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file diff --git a/Tests/wrongEnvironmentURL.ts b/Tests/wrongEnvironmentURL.ts new file mode 100644 index 0000000..e6d1d52 --- /dev/null +++ b/Tests/wrongEnvironmentURL.ts @@ -0,0 +1,28 @@ +import fs = require('fs'); +import mockanswer = require('vsts-task-lib/mock-answer'); +import mockrun = require('vsts-task-lib/mock-run'); +import path = require('path') + +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); + +console.info(taskPath); +let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); +let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); +runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionFileSource", filePath); +runner.setInput("environmentSourceType",'url') +runner.setInput("environmentUrl",'http://') + +let answers = { + checkPath: {}, + which: { + 'newman': 'newman' + }, + stats:{} +}; +answers.checkPath[filePath] = true; +answers.checkPath['newman'] = true; +answers.stats[filePath]=true; +runner.setAnswers(answers); + +runner.run(); \ No newline at end of file From c29183fc025dbb8a03ec2440fa689107aeb4177c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Dec 2018 20:56:44 +0100 Subject: [PATCH 6/8] code format, try to fix compile issue --- .gitignore | 4 +++- .taskkey | 2 +- NewmanPostman/newmantask.js | 1 - NewmanPostman/npm-debug.log | 2 +- Tests/TestSuite.js | 1 - Tests/TestSuite.ts | 4 ++-- Tests/customReporterTest.js | 7 +++---- Tests/customReporterTest.ts | 7 +++---- Tests/emptyCollectionTest.js | 7 +++---- Tests/emptyCollectionTest.ts | 15 +++++++-------- Tests/emptyContents.js | 7 +++---- Tests/emptyContents.ts | 11 +++++------ Tests/emptyEnvironmentFile.ts | 13 ++++++------- Tests/emptyEnvironmentURL.ts | 13 ++++++------- Tests/folderTest.js | 7 +++---- Tests/folderTest.ts | 21 ++++++++++----------- Tests/globalVarFileTest.js | 7 +++---- Tests/globalVarFileTest.ts | 25 ++++++++++++------------- Tests/globalVarTest.js | 7 +++---- Tests/globalVarTest.ts | 22 +++++++++++----------- Tests/noEnvironment.ts | 13 ++++++------- Tests/numberOfIterationTest.js | 7 +++---- Tests/numberOfIterationTest.ts | 21 ++++++++++----------- Tests/useCollectionURL.ts | 13 ++++++------- Tests/useEnvironmentFile.ts | 23 +++++++++++------------ Tests/useEnvironmentURL.ts | 14 +++++++------- Tests/wrongCollectionURL.ts | 13 ++++++------- Tests/wrongEnvironmentURL.ts | 15 +++++++-------- tsconfig.json | 1 - 29 files changed, 141 insertions(+), 162 deletions(-) diff --git a/.gitignore b/.gitignore index 56da602..f0f385f 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,6 @@ node_modules .vscode *.vsix *.map -*.js \ No newline at end of file +*.js +NewmanPostman/npm-debug.log +.taskkey \ No newline at end of file diff --git a/.taskkey b/.taskkey index 2f0d4dd..81de7d2 100644 --- a/.taskkey +++ b/.taskkey @@ -1 +1 @@ -a5e231a5-35e1-425a-b6aa-f1b68a86532e \ No newline at end of file +a275bfa5-d1d9-4247-af04-857b1beae33c \ No newline at end of file diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index 3909a85..d074e50 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -168,4 +168,3 @@ function run() { }); } run(); -//# sourceMappingURL=newmantask.js.map \ No newline at end of file diff --git a/NewmanPostman/npm-debug.log b/NewmanPostman/npm-debug.log index d5cabdd..015d294 100644 --- a/NewmanPostman/npm-debug.log +++ b/NewmanPostman/npm-debug.log @@ -14,7 +14,7 @@ 10 verbose lifecycle task@1.0.0~test: CWD: F:\DocSéb\NewmanPostman_VSTS_Task\NewmanPostman 11 silly lifecycle task@1.0.0~test: Args: [ '/d /s /c', 'echo "Error: no test specified" && exit 1' ] 12 silly lifecycle task@1.0.0~test: Returned: code: 1 signal: null -13 info lifecycle task@1.0.0~test: Failed to exec test script +13 info lifecycl e task@1.0.0~test: Failed to exec test script 14 verbose stack Error: task@1.0.0 test: `echo "Error: no test specified" && exit 1` 14 verbose stack Exit status 1 14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) diff --git a/Tests/TestSuite.js b/Tests/TestSuite.js index 6afaad1..038ff84 100644 --- a/Tests/TestSuite.js +++ b/Tests/TestSuite.js @@ -143,4 +143,3 @@ describe('Normal behavior', function () { done(); }); }); -//# sourceMappingURL=TestSuite.js.map \ No newline at end of file diff --git a/Tests/TestSuite.ts b/Tests/TestSuite.ts index 824ccb9..9af612b 100644 --- a/Tests/TestSuite.ts +++ b/Tests/TestSuite.ts @@ -76,13 +76,13 @@ describe('Normal behavior', function () { assert(runner.stdOutContained('No environment set, no need to add it in argument'), 'No error if no envt is set'); done(); }) - it ('When environment file is set, it\'s used', (done:MochaDone)=>{ + it('When environment file is set, it\'s used', (done: MochaDone) => { this.timeout(1000); let testPath = path.join(__dirname, 'useEnvironmentFile.js'); let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath); runner.run(); // console.error(runner.stdout); - assert(runner.stdOutContained('-e '+path.join(__dirname, 'assets/Core.postman_collection.json')), 'environment file can be used'); + assert(runner.stdOutContained('-e ' + path.join(__dirname, 'assets/Core.postman_collection.json')), 'environment file can be used'); done(); }); it('URL can be set for collection', (done: MochaDone) => { diff --git a/Tests/customReporterTest.js b/Tests/customReporterTest.js index dad4409..5de4fc4 100644 --- a/Tests/customReporterTest.js +++ b/Tests/customReporterTest.js @@ -13,11 +13,11 @@ runner.setInput("Contents", path.normalize("**/collection.json")); runner.setInput("environmentFile", environment); runner.setInput("reporters", 'cli,json'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; @@ -25,4 +25,3 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=customReporterTest.js.map \ No newline at end of file diff --git a/Tests/customReporterTest.ts b/Tests/customReporterTest.ts index 846edcc..cc3f88e 100644 --- a/Tests/customReporterTest.ts +++ b/Tests/customReporterTest.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -17,11 +16,11 @@ runner.setInput("environmentFile", environment); runner.setInput("reporters", 'cli,json'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; diff --git a/Tests/emptyCollectionTest.js b/Tests/emptyCollectionTest.js index 4d5b3dd..f9370fc 100644 --- a/Tests/emptyCollectionTest.js +++ b/Tests/emptyCollectionTest.js @@ -11,15 +11,14 @@ runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=emptyCollectionTest.js.map \ No newline at end of file diff --git a/Tests/emptyCollectionTest.ts b/Tests/emptyCollectionTest.ts index 0b4f56f..861654e 100644 --- a/Tests/emptyCollectionTest.ts +++ b/Tests/emptyCollectionTest.ts @@ -1,28 +1,27 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); -let filePath=''; +let filePath = ''; let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/emptyContents.js b/Tests/emptyContents.js index 0eebed0..8e9a1e3 100644 --- a/Tests/emptyContents.js +++ b/Tests/emptyContents.js @@ -11,11 +11,11 @@ runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", ''); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; @@ -31,4 +31,3 @@ runner.registerMockExport('stats', (itemPath) => { } }); runner.run(); -//# sourceMappingURL=emptyContents.js.map \ No newline at end of file diff --git a/Tests/emptyContents.ts b/Tests/emptyContents.ts index c093c23..983e1f2 100644 --- a/Tests/emptyContents.ts +++ b/Tests/emptyContents.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -9,16 +8,16 @@ console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("Contents",''); +runner.setInput("Contents", ''); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; diff --git a/Tests/emptyEnvironmentFile.ts b/Tests/emptyEnvironmentFile.ts index 634e552..29b19fc 100644 --- a/Tests/emptyEnvironmentFile.ts +++ b/Tests/emptyEnvironmentFile.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,20 +7,20 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("environmentSourceType",'file') +runner.setInput("environmentSourceType", 'file') let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/emptyEnvironmentURL.ts b/Tests/emptyEnvironmentURL.ts index 3a576a2..720eb1f 100644 --- a/Tests/emptyEnvironmentURL.ts +++ b/Tests/emptyEnvironmentURL.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,20 +7,20 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("environmentSourceType",'url') +runner.setInput("environmentSourceType", 'url') let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/folderTest.js b/Tests/folderTest.js index 1ecd162..65f125f 100644 --- a/Tests/folderTest.js +++ b/Tests/folderTest.js @@ -13,11 +13,11 @@ runner.setInput("Contents", path.normalize("**/collection.json")); runner.setInput("environmentFile", environment); runner.setInput("folder", '/'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; @@ -25,4 +25,3 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=folderTest.js.map \ No newline at end of file diff --git a/Tests/folderTest.ts b/Tests/folderTest.ts index f1c8b9e..0dc3b84 100644 --- a/Tests/folderTest.ts +++ b/Tests/folderTest.ts @@ -1,32 +1,31 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); -runner.setInput("environmentSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environmentFile",environment); -runner.setInput("folder",'/'); +runner.setInput("environmentFile", environment); +runner.setInput("folder", '/'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/globalVarFileTest.js b/Tests/globalVarFileTest.js index d1daa4f..bdde610 100644 --- a/Tests/globalVarFileTest.js +++ b/Tests/globalVarFileTest.js @@ -14,11 +14,11 @@ runner.setInput("Contents", path.normalize("**/collection.json")); runner.setInput("environmentFile", environment); runner.setInput("globalVariables", globalVariables); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; @@ -27,4 +27,3 @@ answers.stats[filePath] = true; answers.checkPath[globalVariables] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=globalVarFileTest.js.map \ No newline at end of file diff --git a/Tests/globalVarFileTest.ts b/Tests/globalVarFileTest.ts index 97a8e19..894cbda 100644 --- a/Tests/globalVarFileTest.ts +++ b/Tests/globalVarFileTest.ts @@ -1,34 +1,33 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -let globalVariables =__dirname; -runner.setInput("collectionSourceType",'file'); -runner.setInput("environmentSourceType",'file'); +let globalVariables = __dirname; +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environmentFile",environment); -runner.setInput("globalVariables",globalVariables); +runner.setInput("environmentFile", environment); +runner.setInput("globalVariables", globalVariables); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; -answers.checkPath[globalVariables]=true; +answers.stats[filePath] = true; +answers.checkPath[globalVariables] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/globalVarTest.js b/Tests/globalVarTest.js index 527c4ea..fcff351 100644 --- a/Tests/globalVarTest.js +++ b/Tests/globalVarTest.js @@ -14,11 +14,11 @@ runner.setInput("Contents", path.normalize("**/collection.json")); runner.setInput("environmentFile", environment); runner.setInput("globalVars", globalVars); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; @@ -26,4 +26,3 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=globalVarTest.js.map \ No newline at end of file diff --git a/Tests/globalVarTest.ts b/Tests/globalVarTest.ts index 9e21ce3..1f0ee1a 100644 --- a/Tests/globalVarTest.ts +++ b/Tests/globalVarTest.ts @@ -2,31 +2,31 @@ import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -let globalVars ="var1=1\nvar2=2"; -runner.setInput("collectionSourceType",'file'); -runner.setInput("environmentSourceType",'file'); +let globalVars = "var1=1\nvar2=2"; +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environmentFile",environment); -runner.setInput("globalVars",globalVars); +runner.setInput("environmentFile", environment); +runner.setInput("globalVars", globalVars); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/noEnvironment.ts b/Tests/noEnvironment.ts index 18dea01..d7ee55c 100644 --- a/Tests/noEnvironment.ts +++ b/Tests/noEnvironment.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,20 +7,20 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("environmentSourceType","none") +runner.setInput("environmentSourceType", "none") let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/numberOfIterationTest.js b/Tests/numberOfIterationTest.js index 219b6cc..796f8a4 100644 --- a/Tests/numberOfIterationTest.js +++ b/Tests/numberOfIterationTest.js @@ -13,11 +13,11 @@ runner.setInput("Contents", path.normalize("**/collection.json")); runner.setInput("environmentFile", environment); runner.setInput("numberOfIterations", '2'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats: {} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath[environment] = true; @@ -25,4 +25,3 @@ answers.checkPath['newman'] = true; answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); -//# sourceMappingURL=numberOfIterationTest.js.map \ No newline at end of file diff --git a/Tests/numberOfIterationTest.ts b/Tests/numberOfIterationTest.ts index 77c9404..67344d2 100644 --- a/Tests/numberOfIterationTest.ts +++ b/Tests/numberOfIterationTest.ts @@ -1,32 +1,31 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); -runner.setInput("environmentSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environmentFile",environment); -runner.setInput("numberOfIterations",'2'); +runner.setInput("environmentFile", environment); +runner.setInput("numberOfIterations", '2'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/useCollectionURL.ts b/Tests/useCollectionURL.ts index 0d893b1..1fea211 100644 --- a/Tests/useCollectionURL.ts +++ b/Tests/useCollectionURL.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,21 +7,21 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'url'); +runner.setInput("collectionSourceType", 'url'); runner.setInput("collectionUrl", "https://api.getpostman.com/collections/$collectionUid?apikey=$apiKey"); -runner.setInput("environmentSourceType",'none'); +runner.setInput("environmentSourceType", 'none'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/useEnvironmentFile.ts b/Tests/useEnvironmentFile.ts index d60ee10..a4555c3 100644 --- a/Tests/useEnvironmentFile.ts +++ b/Tests/useEnvironmentFile.ts @@ -1,34 +1,33 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') -let taskPath = path.join(__dirname, '..', 'NewmanPostman','newmantask.js'); +let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); let environment = path.join(__dirname, 'assets/Core.postman_collection.json'); -let globalVariables =__dirname; -runner.setInput("collectionSourceType",'file'); -runner.setInput("environmentSourceType",'file'); +let globalVariables = __dirname; +runner.setInput("collectionSourceType", 'file'); +runner.setInput("environmentSourceType", 'file'); runner.setInput("collectionFileSource", filePath); runner.setInput("Contents", path.normalize("**/collection.json")); -runner.setInput ("environmentFile",environment); +runner.setInput("environmentFile", environment); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; -answers.checkPath[environment]=true; +answers.checkPath[environment] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; -answers.checkPath[globalVariables]=true; +answers.stats[filePath] = true; +answers.checkPath[globalVariables] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/useEnvironmentURL.ts b/Tests/useEnvironmentURL.ts index c340b6c..04ff733 100644 --- a/Tests/useEnvironmentURL.ts +++ b/Tests/useEnvironmentURL.ts @@ -8,22 +8,22 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("environmentSourceType",'url'); -runner.setInput("environmentUrl","https://api.getpostman.com/environments?apikey=$apiKey") +runner.setInput("environmentSourceType", 'url'); +runner.setInput("environmentUrl", "https://api.getpostman.com/environments?apikey=$apiKey") let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/wrongCollectionURL.ts b/Tests/wrongCollectionURL.ts index 5cfab5d..ab70506 100644 --- a/Tests/wrongCollectionURL.ts +++ b/Tests/wrongCollectionURL.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,21 +7,21 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'url'); +runner.setInput("collectionSourceType", 'url'); runner.setInput("collectionUrl", "http://"); -runner.setInput("environmentSourceType",'none'); +runner.setInput("environmentSourceType", 'none'); let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/Tests/wrongEnvironmentURL.ts b/Tests/wrongEnvironmentURL.ts index e6d1d52..e8b97e6 100644 --- a/Tests/wrongEnvironmentURL.ts +++ b/Tests/wrongEnvironmentURL.ts @@ -1,4 +1,3 @@ -import fs = require('fs'); import mockanswer = require('vsts-task-lib/mock-answer'); import mockrun = require('vsts-task-lib/mock-run'); import path = require('path') @@ -8,21 +7,21 @@ let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); let filePath = path.join(__dirname, '/assets/Core.postman_collection.json'); -runner.setInput("collectionSourceType",'file'); +runner.setInput("collectionSourceType", 'file'); runner.setInput("collectionFileSource", filePath); -runner.setInput("environmentSourceType",'url') -runner.setInput("environmentUrl",'http://') +runner.setInput("environmentSourceType", 'url') +runner.setInput("environmentUrl", 'http://') let answers = { - checkPath: {}, - which: { + "checkPath": {}, + "which": { 'newman': 'newman' }, - stats:{} + "stats": {} }; answers.checkPath[filePath] = true; answers.checkPath['newman'] = true; -answers.stats[filePath]=true; +answers.stats[filePath] = true; runner.setAnswers(answers); runner.run(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index fdde581..e58f785 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "target": "ES6", - "sourceMap": true, "module": "commonjs" }, "exclude": [ From 94529cb8cc09c50359de1196559032252b852f20 Mon Sep 17 00:00:00 2001 From: capseb Date: Thu, 13 Dec 2018 14:17:44 +0100 Subject: [PATCH 7/8] update from vsts-task-lib to azure-pipeline-task-lib --- .taskkey | 2 +- NewmanPostman/newmantask.js | 2 +- NewmanPostman/newmantask.ts | 4 +- NewmanPostman/package-lock.json | 58 ++-- NewmanPostman/package.json | 2 +- Tests/TestSuite.js | 2 +- Tests/TestSuite.ts | 2 +- Tests/customReporterTest.js | 2 +- Tests/customReporterTest.ts | 4 +- Tests/emptyCollectionTest.js | 2 +- Tests/emptyCollectionTest.ts | 4 +- Tests/emptyContents.js | 2 +- Tests/emptyContents.ts | 4 +- Tests/emptyEnvironmentFile.ts | 4 +- Tests/emptyEnvironmentURL.ts | 4 +- Tests/folderTest.js | 2 +- Tests/folderTest.ts | 4 +- Tests/globalVarFileTest.js | 2 +- Tests/globalVarFileTest.ts | 4 +- Tests/globalVarTest.js | 2 +- Tests/globalVarTest.ts | 4 +- Tests/noEnvironment.ts | 4 +- Tests/numberOfIterationTest.js | 2 +- Tests/numberOfIterationTest.ts | 4 +- Tests/useCollectionURL.ts | 4 +- Tests/useEnvironmentFile.ts | 4 +- Tests/useEnvironmentURL.ts | 4 +- Tests/wrongCollectionURL.ts | 4 +- Tests/wrongEnvironmentURL.ts | 4 +- package-lock.json | 543 ++++++++++++++++++-------------- package.json | 3 +- 31 files changed, 385 insertions(+), 307 deletions(-) diff --git a/.taskkey b/.taskkey index 81de7d2..05bd1e6 100644 --- a/.taskkey +++ b/.taskkey @@ -1 +1 @@ -a275bfa5-d1d9-4247-af04-857b1beae33c \ No newline at end of file +50b97bc7-c5e2-43da-b4e3-5a40c304aed9 \ No newline at end of file diff --git a/NewmanPostman/newmantask.js b/NewmanPostman/newmantask.js index d074e50..7f7de7c 100644 --- a/NewmanPostman/newmantask.js +++ b/NewmanPostman/newmantask.js @@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); -const tl = require("vsts-task-lib/task"); +const tl = require("azure-pipelines-task-lib/task"); const isurl = require("is-url"); function GetToolRunner(collectionToRun) { let pathToNewman = tl.getInput('pathToNewman', false); diff --git a/NewmanPostman/newmantask.ts b/NewmanPostman/newmantask.ts index f0b252c..20e14a3 100644 --- a/NewmanPostman/newmantask.ts +++ b/NewmanPostman/newmantask.ts @@ -1,6 +1,6 @@ import path = require('path'); -import tl = require('vsts-task-lib/task'); -import trm = require('vsts-task-lib/toolrunner'); +import tl = require('azure-pipelines-task-lib/task'); +import trm = require('azure-pipelines-task-lib/toolrunner'); import isurl = require('is-url'); function GetToolRunner(collectionToRun: string) { diff --git a/NewmanPostman/package-lock.json b/NewmanPostman/package-lock.json index cc393c9..cd7b6b3 100644 --- a/NewmanPostman/package-lock.json +++ b/NewmanPostman/package-lock.json @@ -13,20 +13,33 @@ "@types/q": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.0.2.tgz", - "integrity": "sha512-XupAeovvjZlY23uWY2BT62DgG5BxaHH+qTz8FQQZ0v/FXHcPy3nFIZMfw3fIBMqTGn+13SblIyBNiE8eTO7Ryw==", + "integrity": "sha1-QfCw9q4O7tOlGwA+LgjLpVJbdPY=", "dev": true }, + "azure-pipelines-task-lib": { + "version": "2.7.7", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-2.7.7.tgz", + "integrity": "sha512-4KBPheFTxTDqvaY0bjs9/Ab5yb2c/Y5u8gd54UGL2xhGbv2eoahOZPerAUY/vKsUDu2mjlP/JAWTlDv7dghdRQ==", + "requires": { + "minimatch": "3.0.4", + "mockery": "1.7.0", + "q": "1.5.1", + "semver": "5.6.0", + "shelljs": "0.3.0", + "uuid": "3.3.2" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -35,12 +48,18 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "mockery": { @@ -59,13 +78,13 @@ "integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==" }, "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" }, "shelljs": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=" }, "tslib": { @@ -74,22 +93,9 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" }, "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" - }, - "vsts-task-lib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vsts-task-lib/-/vsts-task-lib-2.1.0.tgz", - "integrity": "sha1-w3Gu/yqNmEOIZSNdyfyUcBxATIQ=", - "requires": { - "minimatch": "^3.0.0", - "mockery": "^1.7.0", - "q": "^1.1.2", - "semver": "^5.1.0", - "shelljs": "^0.3.0", - "uuid": "^3.0.1" - } + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" } } } diff --git a/NewmanPostman/package.json b/NewmanPostman/package.json index 2b8ed75..5e91f48 100644 --- a/NewmanPostman/package.json +++ b/NewmanPostman/package.json @@ -6,7 +6,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "vsts-task-lib": "^2.0.5", + "azure-pipelines-task-lib": "^2.7.7", "reflect-metadata": "^0.1.12", "tslib": "^1.9.3" }, diff --git a/Tests/TestSuite.js b/Tests/TestSuite.js index 038ff84..a80a3b4 100644 --- a/Tests/TestSuite.js +++ b/Tests/TestSuite.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mocktest = require("vsts-task-lib/mock-test"); +const mocktest = require("azure-pipelines-task-lib/mock-test"); const path = require("path"); const assert = require("assert"); describe('Error handling', function () { diff --git a/Tests/TestSuite.ts b/Tests/TestSuite.ts index 9af612b..da20964 100644 --- a/Tests/TestSuite.ts +++ b/Tests/TestSuite.ts @@ -1,4 +1,4 @@ -import * as mocktest from 'vsts-task-lib/mock-test'; +import * as mocktest from 'azure-pipelines-task-lib/mock-test'; import * as path from 'path'; import * as assert from 'assert'; diff --git a/Tests/customReporterTest.js b/Tests/customReporterTest.js index 5de4fc4..049168c 100644 --- a/Tests/customReporterTest.js +++ b/Tests/customReporterTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); diff --git a/Tests/customReporterTest.ts b/Tests/customReporterTest.ts index cc3f88e..dc15a79 100644 --- a/Tests/customReporterTest.ts +++ b/Tests/customReporterTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/emptyCollectionTest.js b/Tests/emptyCollectionTest.js index f9370fc..3a36411 100644 --- a/Tests/emptyCollectionTest.js +++ b/Tests/emptyCollectionTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); diff --git a/Tests/emptyCollectionTest.ts b/Tests/emptyCollectionTest.ts index 861654e..af1ea35 100644 --- a/Tests/emptyCollectionTest.ts +++ b/Tests/emptyCollectionTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/emptyContents.js b/Tests/emptyContents.js index 8e9a1e3..0a9fd47 100644 --- a/Tests/emptyContents.js +++ b/Tests/emptyContents.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); console.info(taskPath); diff --git a/Tests/emptyContents.ts b/Tests/emptyContents.ts index 983e1f2..0ab6d42 100644 --- a/Tests/emptyContents.ts +++ b/Tests/emptyContents.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/emptyEnvironmentFile.ts b/Tests/emptyEnvironmentFile.ts index 29b19fc..7515fb2 100644 --- a/Tests/emptyEnvironmentFile.ts +++ b/Tests/emptyEnvironmentFile.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/emptyEnvironmentURL.ts b/Tests/emptyEnvironmentURL.ts index 720eb1f..30ed541 100644 --- a/Tests/emptyEnvironmentURL.ts +++ b/Tests/emptyEnvironmentURL.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/folderTest.js b/Tests/folderTest.js index 65f125f..fddea9b 100644 --- a/Tests/folderTest.js +++ b/Tests/folderTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); diff --git a/Tests/folderTest.ts b/Tests/folderTest.ts index 0dc3b84..c67e76b 100644 --- a/Tests/folderTest.ts +++ b/Tests/folderTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/globalVarFileTest.js b/Tests/globalVarFileTest.js index bdde610..96c00c8 100644 --- a/Tests/globalVarFileTest.js +++ b/Tests/globalVarFileTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); diff --git a/Tests/globalVarFileTest.ts b/Tests/globalVarFileTest.ts index 894cbda..b72b6f8 100644 --- a/Tests/globalVarFileTest.ts +++ b/Tests/globalVarFileTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/globalVarTest.js b/Tests/globalVarTest.js index fcff351..8d24644 100644 --- a/Tests/globalVarTest.js +++ b/Tests/globalVarTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); diff --git a/Tests/globalVarTest.ts b/Tests/globalVarTest.ts index 1f0ee1a..c50203e 100644 --- a/Tests/globalVarTest.ts +++ b/Tests/globalVarTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/noEnvironment.ts b/Tests/noEnvironment.ts index d7ee55c..df16245 100644 --- a/Tests/noEnvironment.ts +++ b/Tests/noEnvironment.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/numberOfIterationTest.js b/Tests/numberOfIterationTest.js index 796f8a4..a3f6d73 100644 --- a/Tests/numberOfIterationTest.js +++ b/Tests/numberOfIterationTest.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const mockrun = require("vsts-task-lib/mock-run"); +const mockrun = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); let runner = new mockrun.TaskMockRunner(taskPath); diff --git a/Tests/numberOfIterationTest.ts b/Tests/numberOfIterationTest.ts index 67344d2..3aaedf3 100644 --- a/Tests/numberOfIterationTest.ts +++ b/Tests/numberOfIterationTest.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/useCollectionURL.ts b/Tests/useCollectionURL.ts index 1fea211..8f92658 100644 --- a/Tests/useCollectionURL.ts +++ b/Tests/useCollectionURL.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/useEnvironmentFile.ts b/Tests/useEnvironmentFile.ts index a4555c3..49769b3 100644 --- a/Tests/useEnvironmentFile.ts +++ b/Tests/useEnvironmentFile.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/useEnvironmentURL.ts b/Tests/useEnvironmentURL.ts index 04ff733..d906215 100644 --- a/Tests/useEnvironmentURL.ts +++ b/Tests/useEnvironmentURL.ts @@ -1,6 +1,6 @@ import fs = require('fs'); -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/wrongCollectionURL.ts b/Tests/wrongCollectionURL.ts index ab70506..ff67513 100644 --- a/Tests/wrongCollectionURL.ts +++ b/Tests/wrongCollectionURL.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/Tests/wrongEnvironmentURL.ts b/Tests/wrongEnvironmentURL.ts index e8b97e6..2b34478 100644 --- a/Tests/wrongEnvironmentURL.ts +++ b/Tests/wrongEnvironmentURL.ts @@ -1,5 +1,5 @@ -import mockanswer = require('vsts-task-lib/mock-answer'); -import mockrun = require('vsts-task-lib/mock-run'); +import mockanswer = require('azure-pipelines-task-lib/mock-answer'); +import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path') let taskPath = path.join(__dirname, '..', 'NewmanPostman', 'newmantask.js'); diff --git a/package-lock.json b/package-lock.json index 11e1715..47ee82e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,12 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/mocha": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", + "dev": true + }, "@types/node": { "version": "8.0.52", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.52.tgz", @@ -28,15 +34,15 @@ "integrity": "sha1-tDYLtYSvFDeZGUJxbyHXxSPR270=", "dev": true, "requires": { - "archiver-utils": "^1.3.0", - "async": "^2.0.0", - "buffer-crc32": "^0.2.1", - "glob": "^7.0.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0", - "tar-stream": "^1.5.0", - "walkdir": "^0.0.11", - "zip-stream": "^1.2.0" + "archiver-utils": "1.3.0", + "async": "2.6.1", + "buffer-crc32": "0.2.13", + "glob": "7.1.2", + "lodash": "4.17.11", + "readable-stream": "2.3.6", + "tar-stream": "1.6.1", + "walkdir": "0.0.11", + "zip-stream": "1.2.0" }, "dependencies": { "async": { @@ -45,7 +51,7 @@ "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", "dev": true, "requires": { - "lodash": "^4.17.10" + "lodash": "4.17.11" } } } @@ -56,12 +62,12 @@ "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", "dev": true, "requires": { - "glob": "^7.0.0", - "graceful-fs": "^4.1.0", - "lazystream": "^1.0.0", - "lodash": "^4.8.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "lazystream": "1.0.0", + "lodash": "4.17.11", + "normalize-path": "2.1.1", + "readable-stream": "2.3.6" } }, "array-find-index": { @@ -82,6 +88,19 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "azure-pipelines-task-lib": { + "version": "2.7.7", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-2.7.7.tgz", + "integrity": "sha512-4KBPheFTxTDqvaY0bjs9/Ab5yb2c/Y5u8gd54UGL2xhGbv2eoahOZPerAUY/vKsUDu2mjlP/JAWTlDv7dghdRQ==", + "requires": { + "minimatch": "3.0.4", + "mockery": "1.7.0", + "q": "1.5.1", + "semver": "5.4.1", + "shelljs": "0.3.0", + "uuid": "3.1.0" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -99,8 +118,8 @@ "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", "dev": true, "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" + "readable-stream": "2.3.6", + "safe-buffer": "5.1.2" } }, "brace-expansion": { @@ -108,18 +127,23 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, "buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" + "base64-js": "1.3.0", + "ieee754": "1.1.12" } }, "buffer-alloc": { @@ -128,8 +152,8 @@ "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", "dev": true, "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" + "buffer-alloc-unsafe": "1.1.0", + "buffer-fill": "1.0.0" } }, "buffer-alloc-unsafe": { @@ -168,9 +192,9 @@ "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" } }, "clipboardy": { @@ -179,8 +203,8 @@ "integrity": "sha512-2WNImOvCRe6r63Gk9pShfkwXsVtKCroMAevIbiae021mS850UkWPbevxsBz3tnvjZIEGvlwaqCPsw+4ulzNgJA==", "dev": true, "requires": { - "arch": "^2.1.0", - "execa": "^0.8.0" + "arch": "2.1.1", + "execa": "0.8.0" } }, "colors": { @@ -189,16 +213,21 @@ "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", "dev": true }, + "commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + }, "compress-commons": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.2.tgz", "integrity": "sha1-UkqfEJA/OoEzibAiXSfEi7dRiQ8=", "dev": true, "requires": { - "buffer-crc32": "^0.2.1", - "crc32-stream": "^2.0.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" + "buffer-crc32": "0.2.13", + "crc32-stream": "2.0.0", + "normalize-path": "2.1.1", + "readable-stream": "2.3.6" } }, "concat-map": { @@ -224,7 +253,7 @@ "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", "dev": true, "requires": { - "buffer": "^5.1.0" + "buffer": "5.2.1" } }, "crc32-stream": { @@ -233,8 +262,8 @@ "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", "dev": true, "requires": { - "crc": "^3.4.4", - "readable-stream": "^2.0.0" + "crc": "3.8.0", + "readable-stream": "2.3.6" } }, "cross-spawn": { @@ -243,9 +272,9 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "lru-cache": "4.1.3", + "shebang-command": "1.2.0", + "which": "1.3.1" } }, "currently-unhandled": { @@ -254,7 +283,7 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "^1.0.1" + "array-find-index": "1.0.2" } }, "cycle": { @@ -269,8 +298,16 @@ "integrity": "sha1-8ny+56ASu/uC6gUVYtOXf2CT27E=", "dev": true, "requires": { - "get-stdin": "*", - "meow": "*" + "get-stdin": "6.0.0", + "meow": "5.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" } }, "decamelize": { @@ -285,8 +322,8 @@ "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" + "decamelize": "1.2.0", + "map-obj": "1.0.1" }, "dependencies": { "map-obj": { @@ -309,16 +346,21 @@ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "requires": { - "object-keys": "^1.0.12" + "object-keys": "1.0.12" } }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "^1.4.0" + "once": "1.4.0" } }, "error-ex": { @@ -327,7 +369,7 @@ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { - "is-arrayish": "^0.2.1" + "is-arrayish": "0.2.1" } }, "es-abstract": { @@ -336,11 +378,11 @@ "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", "dev": true, "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.3", + "is-callable": "1.1.4", + "is-regex": "1.0.4" } }, "es-to-primitive": { @@ -349,9 +391,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" + "is-callable": "1.1.4", + "is-date-object": "1.0.1", + "is-symbol": "1.0.2" } }, "es6-promise": { @@ -360,19 +402,24 @@ "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=", "dev": true }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, "execa": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" } }, "eyes": { @@ -387,7 +434,7 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "2.0.0" } }, "fs-constants": { @@ -399,8 +446,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "function-bind": { "version": "1.1.1", @@ -423,15 +469,14 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "graceful-fs": { @@ -440,21 +485,36 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "function-bind": "^1.1.1" + "function-bind": "1.1.1" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "dev": true }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" + }, "hosted-git-info": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", @@ -489,17 +549,15 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "is-arrayish": { "version": "0.2.1", @@ -513,7 +571,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "^1.0.0" + "builtin-modules": "1.1.1" } }, "is-callable": { @@ -540,7 +598,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "^1.0.1" + "has": "1.0.3" } }, "is-stream": { @@ -555,7 +613,7 @@ "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "1.0.0" } }, "isarray": { @@ -603,11 +661,11 @@ "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", "dev": true, "requires": { - "core-js": "~2.3.0", - "es6-promise": "~3.0.2", - "lie": "~3.1.0", - "pako": "~1.0.2", - "readable-stream": "~2.0.6" + "core-js": "2.3.0", + "es6-promise": "3.0.2", + "lie": "3.1.1", + "pako": "1.0.6", + "readable-stream": "2.0.6" }, "dependencies": { "process-nextick-args": { @@ -622,12 +680,12 @@ "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" } }, "string_decoder": { @@ -644,7 +702,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "^2.0.5" + "readable-stream": "2.3.6" } }, "lie": { @@ -653,7 +711,7 @@ "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", "dev": true, "requires": { - "immediate": "~3.0.5" + "immediate": "3.0.6" } }, "load-json-file": { @@ -662,10 +720,10 @@ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "4.1.11", + "parse-json": "4.0.0", + "pify": "3.0.0", + "strip-bom": "3.0.0" } }, "locate-path": { @@ -674,8 +732,8 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "2.0.0", + "path-exists": "3.0.0" } }, "lodash": { @@ -690,8 +748,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" } }, "lru-cache": { @@ -700,8 +758,8 @@ "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", "dev": true, "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" + "pseudomap": "1.0.2", + "yallist": "2.1.2" } }, "map-obj": { @@ -716,15 +774,15 @@ "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", "dev": true, "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0", - "yargs-parser": "^10.0.0" + "camelcase-keys": "4.2.0", + "decamelize-keys": "1.1.0", + "loud-rejection": "1.6.0", + "minimist-options": "3.0.2", + "normalize-package-data": "2.4.0", + "read-pkg-up": "3.0.0", + "redent": "2.0.0", + "trim-newlines": "2.0.0", + "yargs-parser": "10.1.0" } }, "minimatch": { @@ -732,7 +790,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.8" } }, "minimist": { @@ -747,15 +805,14 @@ "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" + "arrify": "1.0.1", + "is-plain-obj": "1.1.0" } }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" }, @@ -763,16 +820,38 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + } + }, "mockery": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", "integrity": "sha1-9O3g2HUMHJcnwnLqLGBiniyaHE8=" }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -788,13 +867,13 @@ "normalize-package-data": { "version": "2.4.0", "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==", + "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", "dev": true, "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "hosted-git-info": "2.7.1", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.4" } }, "normalize-path": { @@ -803,7 +882,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "^1.0.1" + "remove-trailing-separator": "1.1.0" } }, "npm-run-path": { @@ -812,7 +891,7 @@ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { - "path-key": "^2.0.0" + "path-key": "2.0.1" } }, "object-keys": { @@ -827,17 +906,16 @@ "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "1.1.3", + "es-abstract": "1.12.0" } }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "onecolor": { @@ -870,7 +948,7 @@ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, "requires": { - "p-try": "^1.0.0" + "p-try": "1.0.0" } }, "p-locate": { @@ -879,7 +957,7 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { - "p-limit": "^1.1.0" + "p-limit": "1.3.0" } }, "p-try": { @@ -900,8 +978,8 @@ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "error-ex": "1.3.2", + "json-parse-better-errors": "1.0.2" } }, "path-exists": { @@ -913,8 +991,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { "version": "2.0.1", @@ -928,7 +1005,7 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "pify": "^3.0.0" + "pify": "3.0.0" } }, "pify": { @@ -955,11 +1032,11 @@ "integrity": "sha1-V3VPZPVD/XsIRXB8gY7OYY8F/9w=", "dev": true, "requires": { - "pkginfo": "0.x.x", - "read": "1.0.x", - "revalidator": "0.1.x", - "utile": "0.2.x", - "winston": "0.8.x" + "pkginfo": "0.4.1", + "read": "1.0.7", + "revalidator": "0.1.8", + "utile": "0.2.1", + "winston": "0.8.3" } }, "pseudomap": { @@ -985,7 +1062,7 @@ "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { - "mute-stream": "~0.0.4" + "mute-stream": "0.0.7" } }, "read-pkg": { @@ -994,9 +1071,9 @@ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" + "load-json-file": "4.0.0", + "normalize-package-data": "2.4.0", + "path-type": "3.0.0" } }, "read-pkg-up": { @@ -1005,8 +1082,8 @@ "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" + "find-up": "2.1.0", + "read-pkg": "3.0.0" } }, "readable-stream": { @@ -1015,13 +1092,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "redent": { @@ -1030,8 +1107,8 @@ "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" + "indent-string": "3.2.0", + "strip-indent": "2.0.0" } }, "remove-trailing-separator": { @@ -1049,10 +1126,10 @@ "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "safe-buffer": { @@ -1064,7 +1141,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=", "dev": true }, "semver": { @@ -1078,7 +1155,7 @@ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "shebang-regex": "1.0.0" } }, "shebang-regex": { @@ -1089,7 +1166,7 @@ }, "shelljs": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=" }, "signal-exit": { @@ -1104,8 +1181,8 @@ "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.1" } }, "spdx-exceptions": { @@ -1120,8 +1197,8 @@ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.1" } }, "spdx-license-ids": { @@ -1142,7 +1219,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.2" } }, "strip-bom": { @@ -1163,19 +1240,27 @@ "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", "dev": true }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "3.0.0" + } + }, "tar-stream": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.1.tgz", "integrity": "sha512-IFLM5wp3QrJODQFPm6/to3LJZrONdBY/otxcvDIQzu217zKye6yVR3hhi9lAjrC2Z+m/j5oDxMPb1qcd8cIvpA==", "dev": true, "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.1.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.0", - "xtend": "^4.0.0" + "bl": "1.2.2", + "buffer-alloc": "1.2.0", + "end-of-stream": "1.4.1", + "fs-constants": "1.0.0", + "readable-stream": "2.3.6", + "to-buffer": "1.1.1", + "xtend": "4.0.1" } }, "tfx-cli": { @@ -1186,28 +1271,28 @@ "requires": { "app-root-path": "1.0.0", "archiver": "2.0.3", - "async": "^1.4.0", - "clipboardy": "~1.2.3", - "colors": "~1.3.0", + "async": "1.5.2", + "clipboardy": "1.2.3", + "colors": "1.3.2", "glob": "7.1.2", - "json-in-place": "^1.0.1", - "jszip": "~3.1.5", - "lodash": "~4.17.0", - "minimist": "^1.1.2", - "mkdirp": "^0.5.1", - "onecolor": "^2.5.0", - "os-homedir": "^1.0.1", - "prompt": "^0.2.14", - "read": "^1.0.6", - "shelljs": "^0.5.1", + "json-in-place": "1.0.1", + "jszip": "3.1.5", + "lodash": "4.17.11", + "minimist": "1.2.0", + "mkdirp": "0.5.1", + "onecolor": "2.5.0", + "os-homedir": "1.0.2", + "prompt": "0.2.14", + "read": "1.0.7", + "shelljs": "0.5.3", "tmp": "0.0.26", "tracer": "0.7.4", - "util.promisify": "^1.0.0", - "uuid": "^3.0.1", - "validator": "^3.43.0", - "vso-node-api": "^5.0.0", + "util.promisify": "1.0.0", + "uuid": "3.1.0", + "validator": "3.43.0", + "vso-node-api": "5.1.2", "winreg": "0.0.12", - "xml2js": "^0.4.16" + "xml2js": "0.4.19" }, "dependencies": { "shelljs": { @@ -1230,7 +1315,7 @@ "integrity": "sha1-nvqCDOKhD4H4l5VVus4/FVJs4fI=", "dev": true, "requires": { - "os-tmpdir": "~1.0.0" + "os-tmpdir": "1.0.2" } }, "to-buffer": { @@ -1294,8 +1379,8 @@ "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" + "define-properties": "1.1.3", + "object.getownpropertydescriptors": "2.0.3" } }, "utile": { @@ -1304,12 +1389,12 @@ "integrity": "sha1-kwyI6ZCY1iIINMNWy9mncFItkNc=", "dev": true, "requires": { - "async": "~0.2.9", - "deep-equal": "*", - "i": "0.3.x", - "mkdirp": "0.x.x", - "ncp": "0.4.x", - "rimraf": "2.x.x" + "async": "0.2.10", + "deep-equal": "1.0.1", + "i": "0.3.6", + "mkdirp": "0.5.1", + "ncp": "0.4.2", + "rimraf": "2.6.2" }, "dependencies": { "async": { @@ -1331,8 +1416,8 @@ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "spdx-correct": "3.0.0", + "spdx-expression-parse": "3.0.0" } }, "validator": { @@ -1347,22 +1432,9 @@ "integrity": "sha1-gXtm/+1uEcvXH5O5FvSxicljQls=", "dev": true, "requires": { - "q": "^1.0.1", + "q": "1.5.1", "tunnel": "0.0.4", - "underscore": "^1.8.3" - } - }, - "vsts-task-lib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vsts-task-lib/-/vsts-task-lib-2.1.0.tgz", - "integrity": "sha1-w3Gu/yqNmEOIZSNdyfyUcBxATIQ=", - "requires": { - "minimatch": "^3.0.0", - "mockery": "^1.7.0", - "q": "^1.1.2", - "semver": "^5.1.0", - "shelljs": "^0.3.0", - "uuid": "^3.0.1" + "underscore": "1.9.1" } }, "walkdir": { @@ -1377,7 +1449,7 @@ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { - "isexe": "^2.0.0" + "isexe": "2.0.0" } }, "winreg": { @@ -1392,13 +1464,13 @@ "integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=", "dev": true, "requires": { - "async": "0.2.x", - "colors": "0.6.x", - "cycle": "1.0.x", - "eyes": "0.1.x", - "isstream": "0.1.x", - "pkginfo": "0.3.x", - "stack-trace": "0.0.x" + "async": "0.2.10", + "colors": "0.6.2", + "cycle": "1.0.3", + "eyes": "0.1.8", + "isstream": "0.1.2", + "pkginfo": "0.3.1", + "stack-trace": "0.0.10" }, "dependencies": { "async": { @@ -1424,17 +1496,16 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=", "dev": true, "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "sax": "1.2.4", + "xmlbuilder": "9.0.7" } }, "xmlbuilder": { @@ -1461,7 +1532,7 @@ "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "4.1.0" } }, "zip-stream": { @@ -1470,10 +1541,10 @@ "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", "dev": true, "requires": { - "archiver-utils": "^1.3.0", - "compress-commons": "^1.2.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0" + "archiver-utils": "1.3.0", + "compress-commons": "1.2.2", + "lodash": "4.17.11", + "readable-stream": "2.3.6" } } } diff --git a/package.json b/package.json index 70569ed..d63c25a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "private": true, "version": "0.0.1", "dependencies": { - "vsts-task-lib": "^2.1.0" + "azure-pipelines-task-lib": "^2.7.7", + "mocha": "^5.2.0" } } From f56b1ef76bea157f6c5707aa3c1ff7885c41594c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Dec 2018 20:38:40 +0100 Subject: [PATCH 8/8] retry --- .taskkey | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.taskkey b/.taskkey index 05bd1e6..3b68a89 100644 --- a/.taskkey +++ b/.taskkey @@ -1 +1 @@ -50b97bc7-c5e2-43da-b4e3-5a40c304aed9 \ No newline at end of file +d924104f-083d-4a9b-aaa2-7cc364673a07 \ No newline at end of file