aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_he_dyndns.py18
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")