##// END OF EJS Templates
testing for sanitize
MinRK -
Show More
@@ -2,7 +2,7 b' safe_tests = ['
2 2 "<p>Hi there</p>",
3 3 '<h1 class="foo">Hi There!</h1>',
4 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 8 unsafe_tests = [
@@ -25,12 +25,16 b' casper.notebook_test(function () {'
25 25 var is_safe = self.evaluate(function (item) {
26 26 return IPython.security.is_safe(item);
27 27 }, item);
28 this.test.assert(is_safe, item);
28 this.test.assert(is_safe, "Safe: " + item);
29 29 });
30 30 this.each(unsafe_tests, function (self, item) {
31 31 var is_safe = self.evaluate(function (item) {
32 32 return IPython.security.is_safe(item);
33 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 40 }); No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now