run js tests with base URL

bug in phantomjs prevents testing with escaped base URL,
but this still tests inappropriate escaping
because @ *would* be escaped, but it does not need to be
This commit is contained in:
Min RK 2015-09-22 14:11:45 +02:00
parent 460643ed90
commit b9c27a461a
4 changed files with 12 additions and 8 deletions

View File

@ -222,6 +222,7 @@ class JSController(TestController):
self.section = section
self.xunit = xunit
self.url = url
self.base_url = '/a@b/'
self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE)
js_test_dir = get_js_test_dir()
includes = '--includes=' + os.path.join(js_test_dir,'util.js')
@ -264,7 +265,7 @@ class JSController(TestController):
self.server_port = 0
self._init_server()
if self.server_port:
self.cmd.append("--port=%i" % self.server_port)
self.cmd.append('--url=http://localhost:%i%s' % (self.server_port, self.base_url))
else:
# don't launch tests if the server didn't start
self.cmd = [sys.executable, '-c', 'raise SystemExit(1)']
@ -310,7 +311,7 @@ class JSController(TestController):
'-m', 'notebook',
'--no-browser',
'--notebook-dir', self.nbdir.name,
'--NotebookApp.base_url=/e%40mail/',
'--NotebookApp.base_url=%s' % self.base_url,
]
# ipc doesn't work on Windows, and darwin has crazy-long temp paths,
# which run afoul of ipc's maximum path length.

View File

@ -84,8 +84,8 @@ casper.notebook_test(function () {
longer_first = longer_first||(that.msgs[m].match(/you are overriting/)!= null);
longer_last = longer_last ||(that.msgs[m].match(/will be shadowed/) != null);
}
this.test.assert(longer_first, 'no warnign if registering shorter shortut');
this.test.assert(longer_last , 'no warnign if registering longer shortut');
this.test.assert(longer_first, 'no warning if registering shorter shortut');
this.test.assert(longer_last , 'no warning if registering longer shortut');
})
});

View File

@ -126,14 +126,17 @@ casper.notebook_test(function () {
});
// test start
var url;
var url, base_url;
this.then(function () {
base_url = this.evaluate(function () {
return IPython.notebook.base_url;
});
url = this.evaluate(function () {
return IPython.notebook.kernel.start();
});
});
this.then(function () {
this.test.assertEquals(url, "/api/kernels", "start url is correct");
this.test.assertEquals(url, base_url + "api/kernels", "start url is correct");
});
this.wait_for_kernel_ready();
this.then(function () {
@ -151,7 +154,7 @@ casper.notebook_test(function () {
});
});
this.then(function () {
this.test.assertEquals(url, "/api/kernels?foo=bar", "start url with params is correct");
this.test.assertEquals(url, base_url + "api/kernels?foo=bar", "start url with params is correct");
});
this.wait_for_kernel_ready();
this.then(function () {

View File

@ -79,7 +79,7 @@ casper.open_new_notebook = function () {
};
casper.page_loaded = function() {
// Return whether or not the kernel is running.
// Return whether or not the page has been loaded.
return this.evaluate(function() {
return typeof IPython !== "undefined" &&
IPython.page !== undefined;