18 lines
535 B
Python
18 lines
535 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from unittest import TestCase
|
|
from unittest.mock import patch
|
|
|
|
import server
|
|
|
|
|
|
class ServerConfigurationTests(TestCase):
|
|
@patch.dict(os.environ, {"APP_HOST": "0.0.0.0", "APP_PORT": "8080"})
|
|
@patch("server.ThreadingHTTPServer")
|
|
def test_main_uses_configured_host_and_port(self, http_server) -> None:
|
|
server.main()
|
|
|
|
http_server.assert_called_once_with(("0.0.0.0", 8080), server.AppHandler)
|
|
http_server.return_value.serve_forever.assert_called_once_with()
|