mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
bpo-43762: Add audit events for loading of sqlite3 extensions (GH-25246)
This commit is contained in:
parent
52cd6d5e1b
commit
7244c0060d
7 changed files with 86 additions and 0 deletions
|
@ -130,6 +130,7 @@ class AuditTest(unittest.TestCase):
|
|||
["gc.get_objects", "gc.get_referrers", "gc.get_referents"]
|
||||
)
|
||||
|
||||
|
||||
def test_http(self):
|
||||
import_helper.import_module("http.client")
|
||||
returncode, events, stderr = self.run_python("test_http_client")
|
||||
|
@ -145,5 +146,27 @@ class AuditTest(unittest.TestCase):
|
|||
self.assertIn('HTTP', events[1][2])
|
||||
|
||||
|
||||
def test_sqlite3(self):
|
||||
try:
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
return
|
||||
returncode, events, stderr = self.run_python("test_sqlite3")
|
||||
if returncode:
|
||||
self.fail(stderr)
|
||||
|
||||
if support.verbose:
|
||||
print(*events, sep='\n')
|
||||
actual = [ev[0] for ev in events]
|
||||
expected = ["sqlite3.connect", "sqlite3.connect/handle"]
|
||||
|
||||
if hasattr(sqlite3.Connection, "enable_load_extension"):
|
||||
expected += [
|
||||
"sqlite3.enable_load_extension",
|
||||
"sqlite3.load_extension",
|
||||
]
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue