Merge "Add a unit test with a simple sql injection ala xkcd"

This commit is contained in:
Jenkins 2017-08-02 02:59:33 +00:00 committed by Gerrit Code Review
commit 4cbd7e4bc4

View File

@ -88,6 +88,12 @@ class TestDatabaseAPI(base.TestCase):
['fake_test1', 'fake_test2', 'fake_test3']) ['fake_test1', 'fake_test2', 'fake_test3'])
self.assertEqual([], result) self.assertEqual([], result)
def test_get_test_with_sql_injection(self):
api.create_test("test_terror'); DROP TABLE tests;")
res = api.get_all_tests()
self.assertEqual(len(res), 1)
self.assertEqual(res[0].test_id, "test_terror'); DROP TABLE tests;")
def test_create_run_and_list(self): def test_create_run_and_list(self):
res = api.create_run() res = api.create_run()
self.assertIsNotNone(res) self.assertIsNotNone(res)