def test_raise_invalid_css_when_get_no_semicolon(self):
     'CSSLint("css without semicolon at line end") should raise invalid css'
     css_without_semicolon = """a.big {color: blue
         border: 1px solid black;
     }"""
     css = CSSLint(css_without_semicolon)
     assert_raises(InvalidCSSError, css.validate, exc_pattern=r'Syntax error on line 2 column 19. Got the unexpected char ":"')
 def _test_raise_invalid_js_when_get_no_semicolon(self):
     'JSLint("js without semicolon at line end") should raise invalid js'
     js_without_semicolon = """var a = 0
         var b = 0;
     }"""
     js = JSLint(js_without_semicolon)
     assert_raises(InvalidJSError, js.validate, exc_pattern=r'Syntax error on line 2 column 19')
    def test_raise_invalid_css_with_at_instead_of_semicolon(self):
        'CSSLint("css with a at instead of semicolon at line end") should raise invalid css'
        css_without_semicolon = """a.big {
            color: red@
            border: 1px solid black;
        }"""
        css = CSSLint(css_without_semicolon)

        assert_raises(InvalidCSSError, css.validate, exc_pattern=r'Syntax error on line 2 column 23. Got the unexpected char "@"')
 def test_rendering_js_fail_when_file_does_not_exist(self):
     t = Template('''{% load medialint_tags %}
         {% jsjoin "/media/js/should-fail-404.js" %}
             <script type="text/javascript" src="/media/js/jquery.js"></script>
             <script type="text/javascript" src="/gluglu.js"></script>
         {% endjsjoin %}
     ''')
     c = RequestContext({})
     assert_raises(TemplateSyntaxError, t.render, c,
                   exc_pattern=r'The file "/gluglu.js" does not exist.')
 def test_rendering_css_fail_when_file_does_not_exist(self):
     t = Template('''{% load medialint_tags %}
         {% cssjoin "/media/css/should-fail-http.css" %}
             <link rel="stylesheet" href="/media/css/text.css" />
             <link rel="stylesheet" href="gluglu.css" />
         {% endcssjoin %}
     ''')
     c = RequestContext({})
     assert_raises(TemplateSyntaxError, t.render, c,
                   exc_pattern=r'The file "gluglu.css" does not exist.')
 def test_rendering_js_fail_when_http_in_link(self):
     t = Template('''{% load medialint_tags %}
         {% jsjoin "/media/js/should-fail-http.js" %}
             <script type="text/javascript" src="/media/js/jquery.js"></script>
             <script type="text/javascript" src="http://globo.com/media/js/jquery.js"></script>
         {% endjsjoin %}
     ''')
     c = RequestContext({})
     assert_raises(TemplateSyntaxError, t.render, c,
                   exc_pattern=r'Links under jsjoin templatetag can' \
                   ' not have full URL [(]starting with http[)]')
 def test_rendering_css_fail_when_http_in_link(self):
     t = Template('''{% load medialint_tags %}
         {% cssjoin "/media/css/should-fail-http.css" %}
             <link rel="stylesheet" href="/media/css/text.css" />
             <link rel="stylesheet" href="http://globo.com/media/css/reset.css" />
         {% endcssjoin %}
     ''')
     c = RequestContext({})
     assert_raises(TemplateSyntaxError, t.render, c,
                   exc_pattern=r'Links under cssjoin templatetag can' \
                   ' not have full URL [(]starting with http[)]')
 def test_find_and_check_css_error(self):
     'CSSLint.fetch_and_check should find and check css files'
     fname = LOCAL_FILE('media', 'css', 'invalid-css1.css')
     assert_raises(InvalidCSSError,
                   CSSLint.check_files, LOCAL_FILE('media'),
                   exc_pattern=r'Syntax error on file: %s line 4 column 11. Got the unexpected char ":"' % fname)
    def _test_raise_invalid_js_with_at_instead_of_semicolon(self):
        'JSLint("js with a at instead of semicolon at line end") should raise invalid js'
        
        js = JSLint(js_without_semicolon)

        assert_raises(InvalidJSError, js.validate, exc_pattern=r'Syntax error on line 2 column 23')