Skip to content

Commit 5f88acb

Browse files
author
Vladimir Kotal
committed
add CommandSequence init test for headers
1 parent b369c88 commit 5f88acb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tools/src/test/python/test_command_sequence.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121

2222
#
23-
# Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
23+
# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2424
#
2525

2626
import os
@@ -180,3 +180,20 @@ def mock_response(uri, headers, data, params, proxies):
180180
mock_response)
181181
commands.run()
182182
assert commands.check([]) == 1
183+
184+
185+
def test_headers_init():
186+
headers = {'foo': 'bar'}
187+
188+
# First verify that header parameter of a command does not impact class member.
189+
commands = CommandSequence(CommandSequenceBase("opengrok-master",
190+
[{'command': ['http://foo', 'PUT', 'data', headers]}]))
191+
192+
assert commands.http_headers is None
193+
194+
# Second, verify that init function propagates the headers.
195+
commands = CommandSequence(CommandSequenceBase("opengrok-master",
196+
[{'command': ['http://foo', 'PUT', 'data']}],
197+
http_headers=headers))
198+
199+
assert commands.http_headers == headers

0 commit comments

Comments
 (0)