'Test dump_js_escaped_json first encodes with custom JSNOEncoder before escaping &, <, and >
The test encoder class should first perform the replacement of "<script>" with
"sample-encoder-was-here", and then should escape the remaining &, <, and >.'

def test_dump_js_escaped_json_with_custom_encoder_escapes_unsafe_html(self):

    malicious_dict = {"</script><script>alert('hello,    ');</script>": self.NoDefaultEncoding("</script><script>alert('&world!');</script>")}
    expected_custom_escaped_json = '{"\\u003c/script\\u003e\\u003cscript\\u003ealert(\'hello,    \');\\u003c/script\\u003e":    "\\u003c/script\\u003esample-encoder-was-herealert(\'\\u0026world!\');\\u003c/script\\u003e"}'
    escaped_json = dump_js_escaped_json(malicious_dict, cls=self.SampleJSONEncoder)
    self.assertEquals(expected_custom_escaped_json, escaped_json)
