diff options
author | Steve Dower <steve.dower@python.org> | 2019-12-09 19:18:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-09 19:18:12 (GMT) |
commit | ee17e3735634c5fe15a43f897707de8011618627 (patch) | |
tree | b3873444a813a981b82be2a47c26a3545bf6cd00 /Lib/test/test_audit.py | |
parent | b8cbe74c3498c617f0e73fd0cdc5c07f2c532092 (diff) | |
download | cpython-ee17e3735634c5fe15a43f897707de8011618627.zip cpython-ee17e3735634c5fe15a43f897707de8011618627.tar.gz cpython-ee17e3735634c5fe15a43f897707de8011618627.tar.bz2 |
bpo-39007: Add auditing events to functions in winreg (GH-17541)
Also allows winreg.CloseKey() to accept same types as other functions.
Diffstat (limited to 'Lib/test/test_audit.py')
-rw-r--r-- | Lib/test/test_audit.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py index 31a0855..73dd5c5 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -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() |