Show More
@@ -2,7 +2,7 b' safe_tests = [' | |||||
2 | "<p>Hi there</p>", |
|
2 | "<p>Hi there</p>", | |
3 | '<h1 class="foo">Hi There!</h1>', |
|
3 | '<h1 class="foo">Hi There!</h1>', | |
4 | '<a data-cite="foo">citation</a>', |
|
4 | '<a data-cite="foo">citation</a>', | |
5 | '<div><span>Hi There</span></div>' |
|
5 | '<div><span>Hi There</span></div>', | |
6 | ]; |
|
6 | ]; | |
7 |
|
7 | |||
8 | unsafe_tests = [ |
|
8 | unsafe_tests = [ | |
@@ -25,12 +25,16 b' casper.notebook_test(function () {' | |||||
25 | var is_safe = self.evaluate(function (item) { |
|
25 | var is_safe = self.evaluate(function (item) { | |
26 | return IPython.security.is_safe(item); |
|
26 | return IPython.security.is_safe(item); | |
27 | }, item); |
|
27 | }, item); | |
28 | this.test.assert(is_safe, item); |
|
28 | this.test.assert(is_safe, "Safe: " + item); | |
29 | }); |
|
29 | }); | |
30 | this.each(unsafe_tests, function (self, item) { |
|
30 | this.each(unsafe_tests, function (self, item) { | |
31 | var is_safe = self.evaluate(function (item) { |
|
31 | var is_safe = self.evaluate(function (item) { | |
32 | return IPython.security.is_safe(item); |
|
32 | return IPython.security.is_safe(item); | |
33 | }, item); |
|
33 | }, item); | |
34 | this.test.assert(!is_safe, item); |
|
34 | this.test.assert(!is_safe, "Unsafe: " + item); | |
|
35 | var sanitized = self.evaluate(function (item) { | |||
|
36 | return IPython.security.sanitize_html(item); | |||
|
37 | }, item); | |||
|
38 | this.test.assertEquals(sanitized.indexOf("alert"), -1, "Sanitized " + item); | |||
35 | }); |
|
39 | }); | |
36 | }); No newline at end of file |
|
40 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now