diff options
author | Saiyang Gou <gousaiyang@163.com> | 2021-04-23 03:19:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 12:19:08 +0200 |
commit | 927b841c215a1ca36c9b3203eadc67ce05b1ed07 (patch) | |
tree | dd5ff8d45bb64842451574b82eaac25a7b5dfd59 /Lib/test/test_audit.py | |
parent | 32980fb669a6857276da18895fcc0cb6f6fbb544 (diff) | |
download | cpython-git-927b841c215a1ca36c9b3203eadc67ce05b1ed07.tar.gz |
bpo-37363: Add audit events to the `http.client` module (GH-21321)
Add audit events to the `http.client` module
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
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 58180e147a..456a5daceb 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -130,6 +130,20 @@ 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") + if returncode: + self.fail(stderr) + + if support.verbose: + print(*events, sep='\n') + self.assertEqual(events[0][0], "http.client.connect") + self.assertEqual(events[0][2], "www.python.org 80") + self.assertEqual(events[1][0], "http.client.send") + if events[1][2] != '[cannot send]': + self.assertIn('HTTP', events[1][2]) + if __name__ == "__main__": unittest.main() |