Add eos changes for Python3 (#24600)

* eos python3 changes

* changes to convert response from byte to text

* Add dellos6 python3 changes
Make `execute_command` arguments and its
return value complaint to PY3 changes
made in PR #24431

* Fix py3 prompt issue for invalid show command
* Fix review comments
* Add generic fix for error prompt in py3
* Fix CI issue
* Fix network_cli unit test failure
This commit is contained in:
Ganesh Nalawade 2017-05-24 19:40:38 +05:30 committed by GitHub
parent daef6f0911
commit 825d9df5ea
6 changed files with 110 additions and 79 deletions

View file

@ -148,7 +148,6 @@ class TestConnectionClass(unittest.TestCase):
pc = PlayContext()
new_stdin = StringIO()
conn = network_cli.Connection(pc, new_stdin)
mock__terminal = MagicMock()
mock__terminal.terminal_stdout_re = [re.compile(b'device#')]
mock__terminal.terminal_stderr_re = [re.compile(b'^ERROR')]
@ -171,9 +170,8 @@ class TestConnectionClass(unittest.TestCase):
self.assertEqual(output, b'command response')
mock__shell.reset_mock()
mock__shell.recv.return_value = b"ERROR: error message"
mock__shell.recv.return_value = b"ERROR: error message device#"
with self.assertRaises(AnsibleConnectionFailure) as exc:
conn.send({'command': b'command'})
self.assertEqual(str(exc.exception), 'ERROR: error message')
self.assertEqual(str(exc.exception), 'ERROR: error message device#')