def test_process_files_with_config_with_shell_injection(self): config = {'ignore': '`cat /etc/passwd`'} tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) assert len(problems) > 0, 'Shell injection fale'
def test_process_files_with_config(self): config = {'ignore': 'box-model'} tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(1, len(problems), 'Config file should lower error count.')
def test_process_files_with_config_with_shell_injection(self): config = { 'ignore': '`cat /etc/passwd`' } tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) assert len(problems) > 0, 'Shell injection fale'
def test_process_files_with_ignore_list(self): config = {'ignore': ['box-model', 'id']} tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) self.assertEqual(1, len(problems), 'Config file should lower error count.')
def test_process_files_with_config(self): config = { 'ignore': 'box-model' } tool = Csslint(self.problems, config) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(1, len(problems), 'Config file should lower error count.')
class TestCsslint(TestCase): fixtures = [ 'tests/fixtures/csslint/no_errors.css', 'tests/fixtures/csslint/has_errors.css', ] def setUp(self): self.problems = Problems() self.tool = Csslint(self.problems, base_path=root_dir) def test_match_file(self): self.assertFalse(self.tool.match_file('test.php')) self.assertFalse(self.tool.match_file('dir/name/test.py')) self.assertFalse(self.tool.match_file('test.py')) self.assertTrue(self.tool.match_file('test.css')) self.assertTrue(self.tool.match_file('dir/name/test.css')) @requires_image('nodejs') def test_check_dependencies(self): self.assertTrue(self.tool.check_dependencies()) @requires_image('nodejs') def test_process_files__one_file_pass(self): self.tool.process_files([self.fixtures[0]]) self.assertEqual([], self.problems.all(self.fixtures[0])) @requires_image('nodejs') def test_process_files__one_file_fail(self): self.tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) self.assertEqual(2, len(problems)) fname = self.fixtures[1] self.assertEqual(fname, problems[0].filename) self.assertEqual(1, problems[0].line) self.assertIn("Warning - Don't use IDs in selectors.", problems[0].body) self.assertEqual(fname, problems[1].filename) self.assertEqual(2, problems[1].line) self.assertIn("Warning - Using width with padding", problems[1].body) @requires_image('nodejs') def test_process_files_two_files(self): self.tool.process_files(self.fixtures) self.assertEqual([], self.problems.all(self.fixtures[0])) problems = self.problems.all(self.fixtures[1]) self.assertEqual(2, len(problems)) @requires_image('nodejs') def test_process_files_with_config(self): config = { 'ignore': 'box-model' } tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) self.assertEqual(1, len(problems), 'Config file should lower error count.') @requires_image('nodejs') def test_process_files_with_config_with_shell_injection(self): config = { 'ignore': '`cat /etc/passwd`' } tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) assert len(problems) > 0, 'Shell injection fale'
def setUp(self): self.problems = Problems() self.tool = Csslint(self.problems, base_path=root_dir)
class TestCsslint(TestCase): fixtures = [ 'tests/fixtures/csslint/no_errors.css', 'tests/fixtures/csslint/has_errors.css', ] def setUp(self): self.problems = Problems() self.tool = Csslint(self.problems, base_path=root_dir) def test_match_file(self): self.assertFalse(self.tool.match_file('test.php')) self.assertFalse(self.tool.match_file('dir/name/test.py')) self.assertFalse(self.tool.match_file('test.py')) self.assertTrue(self.tool.match_file('test.css')) self.assertTrue(self.tool.match_file('dir/name/test.css')) @requires_image('nodejs') def test_check_dependencies(self): self.assertTrue(self.tool.check_dependencies()) @requires_image('nodejs') def test_process_files__one_file_pass(self): self.tool.process_files([self.fixtures[0]]) eq_([], self.problems.all(self.fixtures[0])) @requires_image('nodejs') def test_process_files__one_file_fail(self): self.tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(2, len(problems)) fname = self.fixtures[1] eq_(fname, problems[0].filename) eq_(1, problems[0].line) assert_in("Warning - Don't use IDs in selectors.", problems[0].body) eq_(fname, problems[1].filename) eq_(2, problems[1].line) assert_in("Warning - Using width with padding", problems[1].body) @requires_image('nodejs') def test_process_files_two_files(self): self.tool.process_files(self.fixtures) eq_([], self.problems.all(self.fixtures[0])) problems = self.problems.all(self.fixtures[1]) eq_(2, len(problems)) @requires_image('nodejs') def test_process_files_with_config(self): config = {'ignore': 'box-model'} tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(1, len(problems), 'Config file should lower error count.') @requires_image('nodejs') def test_process_files_with_config_with_shell_injection(self): config = {'ignore': '`cat /etc/passwd`'} tool = Csslint(self.problems, config, root_dir) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) assert len(problems) > 0, 'Shell injection fale'
def setUp(self): self.problems = Problems() self.tool = Csslint(self.problems)
class TestCsslint(TestCase): needs_csslint = skipIf(csslint_missing, 'Needs csslint') fixtures = [ 'tests/fixtures/csslint/no_errors.css', 'tests/fixtures/csslint/has_errors.css', ] def setUp(self): self.problems = Problems() self.tool = Csslint(self.problems) def test_match_file(self): self.assertFalse(self.tool.match_file('test.php')) self.assertFalse(self.tool.match_file('dir/name/test.py')) self.assertFalse(self.tool.match_file('test.py')) self.assertTrue(self.tool.match_file('test.css')) self.assertTrue(self.tool.match_file('dir/name/test.css')) @needs_csslint def test_check_dependencies(self): self.assertTrue(self.tool.check_dependencies()) @needs_csslint def test_process_files__one_file_pass(self): self.tool.process_files([self.fixtures[0]]) eq_([], self.problems.all(self.fixtures[0])) @needs_csslint def test_process_files__one_file_fail(self): self.tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(2, len(problems)) fname = self.fixtures[1] expected = Comment(fname, 1, 1, "Don't use IDs in selectors.") eq_(expected, problems[0]) expected = Comment( fname, 2, 2, "Using width with padding can sometimes make elements larger than you expect.") eq_(expected, problems[1]) @needs_csslint def test_process_files_two_files(self): self.tool.process_files(self.fixtures) eq_([], self.problems.all(self.fixtures[0])) problems = self.problems.all(self.fixtures[1]) eq_(2, len(problems)) @needs_csslint def test_process_files_with_config(self): config = { 'ignore': 'box-model' } tool = Csslint(self.problems, config) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) eq_(1, len(problems), 'Config file should lower error count.') @needs_csslint def test_process_files_with_config_from_evil_jerk(self): config = { 'ignore': '`cat /etc/passwd`' } tool = Csslint(self.problems, config) tool.process_files([self.fixtures[1]]) problems = self.problems.all(self.fixtures[1]) assert len(problems) > 0, 'Shell injection fale'