Exemple #1
0
 def test_bad_file(self):
     errors = py_find_injection.check(os.path.join(SAMPLE_PATH, 'bad_script.py'))
     self.assertEqual(1, len(errors))
     self.assertEqual(errors[0].lineno, 6)
     self.assertEqual(errors[0].reason, 'string interpolation of SQL query')
Exemple #2
0
 def test_interpolation_not_inline(self):
     errors = py_find_injection.check(os.path.join(SAMPLE_PATH, 'bad_script_2.py'))
     self.assertEqual(1, len(errors))
     self.assertEqual(errors[0].lineno, 7)
     self.assertEqual(errors[0].reason, 'string concatenation of SQL query')
Exemple #3
0
 def test_good_file(self):
     errors = py_find_injection.check(os.path.join(SAMPLE_PATH, 'good_script.py'))
     self.assertEqual(errors, [])