summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit/v1/test_shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'glanceclient/tests/unit/v1/test_shell.py')
-rw-r--r--glanceclient/tests/unit/v1/test_shell.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/glanceclient/tests/unit/v1/test_shell.py b/glanceclient/tests/unit/v1/test_shell.py
index 5476a2f..46c6f68 100644
--- a/glanceclient/tests/unit/v1/test_shell.py
+++ b/glanceclient/tests/unit/v1/test_shell.py
@@ -15,11 +15,11 @@
# under the License.
import argparse
+import io
import json
import os
from unittest import mock
-import six
import subprocess
import tempfile
import testtools
@@ -34,12 +34,6 @@ import glanceclient.v1.shell as v1shell
from glanceclient.tests import utils
-if six.PY3:
- import io
- file_type = io.IOBase
-else:
- file_type = file
-
fixtures = {
'/v1/images/96d2c7e1-de4e-4612-8aa2-ba26610c804e': {
'PUT': (
@@ -351,7 +345,7 @@ class ShellInvalidEndpointandParameterTest(utils.TestCase):
@mock.patch('sys.stderr')
def test_image_create_missing_container_format_stdin_data(self, __):
# Fake that get_data_file method returns data
- self.mock_get_data_file.return_value = six.StringIO()
+ self.mock_get_data_file.return_value = io.StringIO()
e = self.assertRaises(exc.CommandError, self.run_command,
'--os-image-api-version 1 image-create'
' --disk-format qcow2')
@@ -361,7 +355,7 @@ class ShellInvalidEndpointandParameterTest(utils.TestCase):
@mock.patch('sys.stderr')
def test_image_create_missing_disk_format_stdin_data(self, __):
# Fake that get_data_file method returns data
- self.mock_get_data_file.return_value = six.StringIO()
+ self.mock_get_data_file.return_value = io.StringIO()
e = self.assertRaises(exc.CommandError, self.run_command,
'--os-image-api-version 1 image-create'
' --container-format bare')
@@ -574,7 +568,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f')
self.assertIn('data', self.collected_args[1])
- self.assertIsInstance(self.collected_args[1]['data'], file_type)
+ self.assertIsInstance(self.collected_args[1]['data'], io.IOBase)
self.assertEqual(b'Some Data',
self.collected_args[1]['data'].read())
@@ -599,7 +593,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f')
self.assertIn('data', self.collected_args[1])
- self.assertIsInstance(self.collected_args[1]['data'], file_type)
+ self.assertIsInstance(self.collected_args[1]['data'], io.IOBase)
self.assertEqual(b'Some Data\n',
self.collected_args[1]['data'].read())