"""Mirrors tests/hello_world.rs.""" import http.client import unittest from server_test_case import HOST, PORT, ServerTestCase class HelloWorldTest(ServerTestCase): def test_hello_world_returns_ok_with_greeting(self): conn = http.client.HTTPConnection(HOST, int(PORT), timeout=5) try: conn.request("GET", "/") response = conn.getresponse() body = response.read() finally: conn.close() self.assertEqual(response.status, 200) self.assertEqual(body, b"Hello, world!") if __name__ == "__main__": unittest.main()