mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Port urls.py to python3 and other byte vs text fixes (#16124)
* Port urls.py to python3 Fixes (largely normalizing byte vs text strings) for python3 * Rework what we do with attributes that aren't set already. * Comments
This commit is contained in:
parent
434c949d03
commit
5a3493be5f
9 changed files with 153 additions and 90 deletions
|
@ -168,13 +168,13 @@ class TestAnsibleModuleRunCommand(unittest.TestCase):
|
|||
|
||||
def test_text_stdin(self):
|
||||
(rc, stdout, stderr) = self.module.run_command('/bin/foo', data='hello world')
|
||||
self.assertEqual(self.cmd.stdin.getvalue(), 'hello world\n')
|
||||
self.assertEqual(self.cmd.stdin.getvalue(), b'hello world\n')
|
||||
|
||||
def test_ascii_stdout(self):
|
||||
self.cmd_out[sentinel.stdout] = BytesIO(b'hello')
|
||||
(rc, stdout, stderr) = self.module.run_command('/bin/cat hello.txt')
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertEqual(stdout, 'hello')
|
||||
self.assertEqual(stdout, b'hello')
|
||||
|
||||
def test_utf8_output(self):
|
||||
self.cmd_out[sentinel.stdout] = BytesIO(u'Žarn§'.encode('utf-8'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue