Skip to content

Commit c2d6bb3

Browse files
committed
gh-135056: Add tests for bad usage of header arg.
1 parent c9c8083 commit c2d6bb3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_httpservers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,14 @@ def test_header_flag(self, mock_func):
14081408
mock_func.assert_called_once_with(**call_args)
14091409
mock_func.reset_mock()
14101410

1411+
def test_extra_header_flag_too_few_args(self):
1412+
with self.assertRaises(SystemExit):
1413+
self.invoke_httpd('--header', 'h1')
1414+
1415+
def test_extra_header_flag_too_many_args(self):
1416+
with self.assertRaises(SystemExit):
1417+
self.invoke_httpd('--header', 'h1', 'v1', 'h2')
1418+
14111419
@unittest.skipIf(ssl is None, "requires ssl")
14121420
@mock.patch('http.server.test')
14131421
def test_tls_cert_and_key_flags(self, mock_func):

0 commit comments

Comments
 (0)