Exemplo n.º 1
0
 def test_script_json_encode(self):
     rv = script_json_encode('</script>')
     assert rv == u_('"\\u003c/script\\u003e"')
     rv = script_json_encode("<\0/script>")
     assert rv == '"\\u003c\\u0000/script\\u003e"'
     rv = script_json_encode("<!--<script>")
     assert rv == '"\\u003c!--\\u003cscript\\u003e"'
     rv = script_json_encode("&")
     assert rv == '"\\u0026"'
     rv = script_json_encode("\'")
     assert rv == '"\\u0027"'
     rv = "<a ng-data='%s'></a>" % script_json_encode({'x': ["foo", "bar", "baz'"]})
     assert rv == '<a ng-data=\'{"x": ["foo", "bar", "baz\\u0027"]}\'></a>'
Exemplo n.º 2
0
 def test_script_json_encode(self):
     rv = script_json_encode('</script>')
     assert rv == u_('"\\u003c/script\\u003e"')
     rv = script_json_encode("<\0/script>")
     assert rv == '"\\u003c\\u0000/script\\u003e"'
     rv = script_json_encode("<!--<script>")
     assert rv == '"\\u003c!--\\u003cscript\\u003e"'
     rv = script_json_encode("&")
     assert rv == '"\\u0026"'
     rv = script_json_encode("\'")
     assert rv == '"\\u0027"'
     rv = "<a ng-data='%s'></a>" % script_json_encode({'x': ["foo", "bar", "baz'"]})
     assert rv == '<a ng-data=\'{"x": ["foo", "bar", "baz\\u0027"]}\'></a>'
Exemplo n.º 3
0
 def test_script_json_encode_array(self):
     rv = "<a ng-data='%s'></a>" % script_json_encode(['1', 2, 5])
     assert rv == '<a ng-data=\'["1", 2, 5]\'></a>', rv
Exemplo n.º 4
0
 def test_script_json_encode_array(self):
     rv = "<a ng-data='%s'></a>" % script_json_encode(['1', 2, 5])
     assert rv == '<a ng-data=\'["1", 2, 5]\'></a>', rv