mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-39007: Add auditing events to functions in winreg (GH-17541)
Also allows winreg.CloseKey() to accept same types as other functions.
This commit is contained in:
parent
b8cbe74c34
commit
ee17e37356
5 changed files with 217 additions and 26 deletions
|
|
@ -104,6 +104,20 @@ class AuditTest(unittest.TestCase):
|
|||
"RuntimeError('nonfatal-error') Exception ignored for audit hook test",
|
||||
)
|
||||
|
||||
def test_winreg(self):
|
||||
support.import_module("winreg")
|
||||
returncode, events, stderr = self.run_python("test_winreg")
|
||||
if returncode:
|
||||
self.fail(stderr)
|
||||
|
||||
self.assertEqual(events[0][0], "winreg.OpenKey")
|
||||
self.assertEqual(events[1][0], "winreg.OpenKey/result")
|
||||
expected = events[1][2]
|
||||
self.assertTrue(expected)
|
||||
self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 0"], events[2])
|
||||
self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 10000"], events[3])
|
||||
self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue