mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
This commit is contained in:
parent
2d2ec058c8
commit
42cfacf83b
3 changed files with 5 additions and 36 deletions
|
@ -93,14 +93,13 @@ class TestPlayContext(unittest.TestCase):
|
|||
mock_task.become_pass = 'mocktaskpass'
|
||||
mock_task.no_log = False
|
||||
|
||||
mock_host = MagicMock()
|
||||
mock_host.get_vars.return_value = dict(
|
||||
all_vars = dict(
|
||||
ansible_connection = 'mock_inventory',
|
||||
ansible_ssh_port = 4321,
|
||||
)
|
||||
|
||||
play_context = PlayContext(play=mock_play, options=options)
|
||||
play_context = play_context.set_task_and_host_override(task=mock_task, host=mock_host)
|
||||
play_context = play_context.set_task_and_variable_override(task=mock_task, variables=all_vars)
|
||||
self.assertEqual(play_context.connection, 'mock_inventory')
|
||||
self.assertEqual(play_context.remote_user, 'mocktask')
|
||||
self.assertEqual(play_context.port, 4321)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue