summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_audit.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-12-09 19:18:12 (GMT)
committerGitHub <noreply@github.com>2019-12-09 19:18:12 (GMT)
commitee17e3735634c5fe15a43f897707de8011618627 (patch)
treeb3873444a813a981b82be2a47c26a3545bf6cd00 /Lib/test/test_audit.py
parentb8cbe74c3498c617f0e73fd0cdc5c07f2c532092 (diff)
downloadcpython-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.py14
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()