Files
Zack Weinberg 3d4f89b41e Bug fixes to test-server Python response hook support.
* correctly fake a package to hold all the response-hook modules
* use StringIO correctly in the response hooks
* prevent .py(c) files in test/www/ from being accessed directly
* prevent test/www/__init__ from being treated as a response hook
* add a test case that makes sure the existing hooks _can_ return 200 OK

(issue #12439; buggy commit 4d60e94)
2014-09-16 20:56:27 +00:00

29 lines
603 B
JavaScript

/* Test the test server itself. */
var assert = require('../assert');
var webpage = require('webpage');
var page = webpage.create();
var urlsToTest = [
'http://localhost:9180/hello.html',
'http://localhost:9180/status?200',
'http://localhost:9180/echo'
];
var i = 0;
page.onResourceReceived = function (response) {
assert.equal(response.status, 200);
};
page.onLoadFinished = function (status) {
assert.equal(status, 'success');
i++;
if (i == urlsToTest.length) {
phantom.exit(0);
} else {
page.open(urlsToTest[i]);
}
}
page.open(urlsToTest[i]);