summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_audit.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-03-31 11:38:53 (GMT)
committerGitHub <noreply@github.com>2020-03-31 11:38:53 (GMT)
commit63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3 (patch)
treea249b3a79cce91fe6a8aa5c3d0e55b1793cdb058 /Lib/test/test_audit.py
parentef67512b40240f765026ad41d60b0c9a6dacd2b9 (diff)
downloadcpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.zip
cpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.tar.gz
cpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.tar.bz2
bpo-40121: Fixes audit event raised on creating a new socket (GH-19238)
Diffstat (limited to 'Lib/test/test_audit.py')
-rw-r--r--Lib/test/test_audit.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py
index 73dd5c5..f405c69 100644
--- a/Lib/test/test_audit.py
+++ b/Lib/test/test_audit.py
@@ -118,6 +118,18 @@ class AuditTest(unittest.TestCase):
self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 10000"], events[3])
self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4])
+ def test_socket(self):
+ support.import_module("socket")
+ returncode, events, stderr = self.run_python("test_socket")
+ if returncode:
+ self.fail(stderr)
+
+ if support.verbose:
+ print(*events, sep='\n')
+ self.assertEqual(events[0][0], "socket.gethostname")
+ self.assertEqual(events[1][0], "socket.__new__")
+ self.assertEqual(events[2][0], "socket.bind")
+ self.assertTrue(events[2][2].endswith("('127.0.0.1', 8080)"))
if __name__ == "__main__":
unittest.main()