mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-07 09:41:29 -07:00
Base connection class for network-style connections (#41839)
* Create base class for network-style connections * clean up some differences * Move NetworkConnectionBase * Tweak netconf for tests * Tweak when network_os is checked to avoid failing tests * Pull back exec_command
This commit is contained in:
parent
380d08af5d
commit
5850591d14
6 changed files with 198 additions and 253 deletions
|
@ -46,9 +46,11 @@ def import_mock(name, *args):
|
|||
if PY3:
|
||||
with patch('builtins.__import__', side_effect=import_mock):
|
||||
from ansible.plugins.connection import netconf
|
||||
from ansible.plugins.loader import connection_loader
|
||||
else:
|
||||
with patch('__builtin__.__import__', side_effect=import_mock):
|
||||
from ansible.plugins.connection import netconf
|
||||
from ansible.plugins.loader import connection_loader
|
||||
|
||||
|
||||
class TestNetconfConnectionClass(unittest.TestCase):
|
||||
|
@ -68,7 +70,7 @@ class TestNetconfConnectionClass(unittest.TestCase):
|
|||
pc = PlayContext()
|
||||
new_stdin = StringIO()
|
||||
|
||||
conn = netconf.Connection(pc, new_stdin)
|
||||
conn = connection_loader.get('netconf', pc, new_stdin)
|
||||
|
||||
mock_manager = MagicMock()
|
||||
mock_manager.session_id = '123456789'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue