StringIO to six
This commit is contained in:
parent
cab2c7b4ea
commit
b4c7433cc4
23 changed files with 165 additions and 215 deletions
|
|
@ -1,14 +1,10 @@
|
|||
from __future__ import absolute_import
|
||||
import unittest
|
||||
|
||||
import StringIO as stringio
|
||||
|
||||
import os
|
||||
|
||||
import sys
|
||||
|
||||
import mock
|
||||
|
||||
import six
|
||||
from mock import call
|
||||
|
||||
from . import loadcli
|
||||
|
|
@ -21,7 +17,7 @@ class TestEditHost(unittest.TestCase):
|
|||
# Show long diffs in error output...
|
||||
maxDiff = None
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
def test_handle_edit_host(self, activate_session_mock, stdout):
|
||||
host = 'host'
|
||||
|
|
@ -60,7 +56,7 @@ class TestEditHost(unittest.TestCase):
|
|||
self.assertEqual(session.multiCall.call_count, 2)
|
||||
self.assertNotEqual(rv, 1)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
def test_handle_edit_host_failed(self, activate_session_mock, stdout):
|
||||
host = 'host'
|
||||
|
|
@ -99,7 +95,7 @@ class TestEditHost(unittest.TestCase):
|
|||
self.assertEqual(session.multiCall.call_count, 2)
|
||||
self.assertNotEqual(rv, 1)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
def test_handle_edit_multi_host(self, activate_session_mock, stdout):
|
||||
hosts = ['host1', 'host2']
|
||||
|
|
@ -145,8 +141,8 @@ class TestEditHost(unittest.TestCase):
|
|||
call.multiCall(strict=True)])
|
||||
self.assertNotEqual(rv, 1)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stderr', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
def test_handle_edit_host_no_arg(
|
||||
self, activate_session_mock, stderr, stdout):
|
||||
|
|
@ -181,7 +177,7 @@ class TestEditHost(unittest.TestCase):
|
|||
session.multiCall.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
def test_handle_edit_host_no_host(self, activate_session_mock, stdout):
|
||||
host = 'host'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue