Skip to content

Commit c475fec

Browse files
committed
Add test
1 parent 5034413 commit c475fec

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/test/test_httpservers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,16 @@ def test_protocol_flag(self, mock_func):
14481448
mock_func.assert_called_once_with(**call_args)
14491449
mock_func.reset_mock()
14501450

1451+
@mock.patch('http.server.test')
1452+
def test_content_type_flag(self, mock_func):
1453+
content_types = ['text/html', 'text/plain', 'application/json']
1454+
for content_type in content_types:
1455+
with self.subTest(content_type=content_type):
1456+
self.invoke_httpd('--content-type', content_type)
1457+
call_args = self.args | dict(content_type=content_type)
1458+
mock_func.assert_called_once_with(**call_args)
1459+
mock_func.reset_mock()
1460+
14511461
@unittest.skipIf(ssl is None, "requires ssl")
14521462
@mock.patch('http.server.test')
14531463
def test_tls_cert_and_key_flags(self, mock_func):

0 commit comments

Comments
 (0)