diff options
| author | Jason McCormick <jason@mfamily.org> | 2026-11-02 20:42:45 -0500 |
|---|---|---|
| committer | Jason McCormick <jason@mfamily.org> | 2026-11-02 20:42:45 -0500 |
| commit | c333e4c76d42dc5c813a52b22fbe5328304a8ae8 (patch) | |
| tree | a8b582bdbce3097947395f4c8a289ee0b3ddb347 /tests | |
| parent | 2474f6cade62ba937ff714f0aa54555f7ebc18d8 (diff) | |
updates for prod
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_he_dyndns.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_he_dyndns.py b/tests/test_he_dyndns.py index d839a26..0fbe343 100644 --- a/tests/test_he_dyndns.py +++ b/tests/test_he_dyndns.py @@ -34,6 +34,24 @@ class EchoTests(unittest.TestCase): with self.assertRaisesRegex(ValueError, "loopback"): ip_echo.proxied_address("192.0.2.10", "198.51.100.20") + def test_error_response_contains_only_status_code(self): + handler = object.__new__(ip_echo.AddressHandler) + handler.command = "GET" + handler.wfile = mock.Mock() + handler.send_response = mock.Mock() + handler.send_header = mock.Mock() + handler.end_headers = mock.Mock() + + handler.send_error(404, "ignored") + + handler.send_response.assert_called_once_with(404) + handler.send_header.assert_has_calls([ + mock.call("Content-Type", "text/plain; charset=us-ascii"), + mock.call("Content-Length", "4"), + ]) + handler.end_headers.assert_called_once_with() + handler.wfile.write.assert_called_once_with(b"404\n") + class DiscoveryTests(unittest.TestCase): @mock.patch.object(he_dyndns, "http_get") |
