'Test _check_mako_file_is_safe in script tag with different media types'

@data({'media_type': 'text/javascript', 'rule': None}, {'media_type': 'text/ecmascript', 'rule': None}, {'media_type': 'application/ecmascript', 'rule': None}, {'media_type': 'application/javascript', 'rule': None}, {'media_type': 'text/x-mathjax-config', 'rule': None}, {'media_type': 'json/xblock-args', 'rule': None}, {'media_type': 'text/template', 'rule': Rules.mako_invalid_html_filter}, {'media_type': 'unknown/type', 'rule': Rules.mako_unknown_context})
def test_check_mako_expressions_in_script_type(self, data):

    linter = MakoTemplateLinter()
    results = FileResults('')
    mako_template = textwrap.dedent('\n                                                <%page    expression_filter="h"/>\n                                                #    switch    to    JavaScript    context\n                                                <script    type="{}">\n                                                                ${{x    |    n,    dump_js_escaped_json}}\n                                                </script>\n                                                ##    switch    back    to    HTML    context\n                                                ${{x}}\n                                ').format(data['media_type'])
    linter._check_mako_file_is_safe(mako_template, results)
    self._validate_data_rules(data, results)
