Test remote exec raises an audit event
(self)
| 2132 | self.assertEqual(mock_stdout.getvalue(), "Done\n") |
| 2133 | |
| 2134 | def test_remote_exec_raises_audit_event(self): |
| 2135 | """Test remote exec raises an audit event""" |
| 2136 | prologue = '''\ |
| 2137 | import sys |
| 2138 | def audit_hook(event, arg): |
| 2139 | print(f"Audit event: {event}, arg: {arg}".encode("ascii", errors="replace")) |
| 2140 | sys.addaudithook(audit_hook) |
| 2141 | ''' |
| 2142 | script = ''' |
| 2143 | print("Remote script executed successfully!") |
| 2144 | ''' |
| 2145 | returncode, stdout, stderr = self._run_remote_exec_test(script, prologue=prologue) |
| 2146 | self.assertEqual(returncode, 0) |
| 2147 | self.assertIn(b"Remote script executed successfully!", stdout) |
| 2148 | self.assertIn(b"Audit event: cpython.remote_debugger_script, arg: ", stdout) |
| 2149 | self.assertEqual(stderr, b"") |
| 2150 | |
| 2151 | def test_remote_exec_with_exception(self): |
| 2152 | """Test remote exec with an exception raised in the target process |
nothing calls this directly
no test coverage detected