mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
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:
parent
460643ed90
commit
b9c27a461a
@ -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.
|
||||
|
@ -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');
|
||||
})
|
||||
|
||||
});
|
||||
|
@ -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 () {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user