-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure that we parse the url again after resolving variables, which
is a solution for: * postmanlabs/postman-app-support#2276 * postmanlabs/postman-app-support#2285
- Loading branch information
Aniket Panse
committed
Aug 24, 2016
1 parent
ccd72f1
commit 34c4555
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module.exports = { | ||
options: {}, | ||
|
||
collection: { | ||
"variables": [], | ||
"info": { | ||
"name": "url-vars", | ||
"_postman_id": "cc88d146-720e-af9a-d530-9ee84ae2ec94", | ||
"description": "", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "{{url}}/:verb", | ||
"event": [ | ||
{ | ||
"listen": "prerequest", | ||
"script": { | ||
"type": "text/javascript", | ||
"exec": "postman.setGlobalVariable(\"url\", \"http://httpbin.org\");" | ||
} | ||
} | ||
], | ||
"request": { | ||
"url": { | ||
"raw": "{{url}}/:verb", | ||
"auth": {}, | ||
"host": [ | ||
"{{url}}" | ||
], | ||
"path": [ | ||
":verb" | ||
], | ||
"variable": [ | ||
{ | ||
"value": "get", | ||
"id": "verb" | ||
} | ||
] | ||
}, | ||
"method": "GET", | ||
"header": [], | ||
"body": { | ||
"mode": "formdata", | ||
"formdata": [] | ||
}, | ||
"description": "" | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe('sanity test', function () { | ||
it('must have started and completed the test run', function () { | ||
expect(testrun).be.ok(); | ||
expect(testrun.done.calledOnce).be.ok(); | ||
expect(testrun.start.calledOnce).be.ok(); | ||
}); | ||
|
||
it('must parse the url after variable resolution', function () { | ||
var request = testrun.beforeRequest.getCall(0).args[2]; | ||
|
||
expect(testrun.beforeRequest.calledOnce).be.ok(); // one request | ||
expect(request).be.ok(); | ||
expect(request.url.host).to.not.match(/^http:\/\/.*/); | ||
expect(request.url.toString()).eql('http://httpbin.org/get'); | ||
expect(request.method).be('GET'); | ||
}); | ||
|
||
it('must receive response with status code 200 OK', function () { | ||
var response = testrun.request.getCall(0).args[2]; | ||
|
||
expect(testrun.request.calledOnce).be.ok(); // one request | ||
expect(response.code).to.be(200); | ||
}); | ||
}); |