'Test check_underscore_file_is_safe with various disabled pragmas'

@data({'template': '<%    //    xss-lint:            disable=underscore-not-escaped            %>\n<%=    message    %>', 'is_disabled': [True]}, {'template': '<%    //    xss-lint:    disable=another-rule,underscore-not-escaped    %>\n<%=    message    %>', 'is_disabled': [True]}, {'template': '<%    //    xss-lint:    disable=another-rule    %>\n<%=    message    %>', 'is_disabled': [False]}, {'template': '<%    //    xss-lint:    disable=underscore-not-escaped    %>\n<%=    message    %>\n<%=    message    %>', 'is_disabled': [True, False]}, {'template': '//    This    test    does    not    use    proper    Underscore.js    Template    syntax\n//    But,    it    is    just    testing    that    a    maximum    of    5    non-whitespace\n//    are    used    to    designate    start    of    line    for    disabling    the    next    line.\n    1    2    3    4    5    xss-lint:    disable=underscore-not-escaped    %>\n<%=    message    %>\n    1    2    3    4    5    6    xss-lint:    disable=underscore-not-escaped    %>\n<%=    message    %>', 'is_disabled': [True, False]}, {'template': '<%=    message    %><%    //    xss-lint:    disable=underscore-not-escaped    %>\n<%=    message    %>', 'is_disabled': [True, False]}, {'template': '<%=    message    %>\n<%    //    xss-lint:    disable=underscore-not-escaped    %>', 'is_disabled': [False]})
def test_check_underscore_file_disable_rule(self, data):

    linter = UnderscoreTemplateLinter()
    results = FileResults('')
    linter.check_underscore_file_is_safe(data['template'], results)
    violation_count = len(data['is_disabled'])
    self.assertEqual(len(results.violations), violation_count)
    for index in range(0, (violation_count - 1)):
        self.assertEqual(results.violations[index].is_disabled, data['is_disabled'][index])
