diff options
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_server.py | 6 | ||||
| -rw-r--r-- | openstackclient/tests/unit/test_shell.py | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index 59282b4a..4bdb322e 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -19,11 +19,11 @@ import getpass from unittest import mock from unittest.mock import call +import iso8601 from novaclient import api_versions from openstack import exceptions as sdk_exceptions from osc_lib import exceptions from osc_lib import utils as common_utils -from oslo_utils import timeutils from openstackclient.compute.v2 import server from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes @@ -2945,7 +2945,7 @@ class TestServerList(TestServer): self.assertEqual(self.columns, columns) self.assertEqual(tuple(self.data), tuple(data)) - @mock.patch.object(timeutils, 'parse_isotime', side_effect=ValueError) + @mock.patch.object(iso8601, 'parse_date', side_effect=iso8601.ParseError) def test_server_list_with_invalid_changes_since(self, mock_parse_isotime): arglist = [ @@ -2988,7 +2988,7 @@ class TestServerList(TestServer): self.assertEqual(self.columns, columns) self.assertEqual(tuple(self.data), tuple(data)) - @mock.patch.object(timeutils, 'parse_isotime', side_effect=ValueError) + @mock.patch.object(iso8601, 'parse_date', side_effect=iso8601.ParseError) def test_server_list_v266_with_invalid_changes_before( self, mock_parse_isotime): self.app.client_manager.compute.api_version = ( diff --git a/openstackclient/tests/unit/test_shell.py b/openstackclient/tests/unit/test_shell.py index 94f4f44d..366c364e 100644 --- a/openstackclient/tests/unit/test_shell.py +++ b/openstackclient/tests/unit/test_shell.py @@ -13,12 +13,12 @@ # under the License. # +import importlib import os import sys from unittest import mock from osc_lib.tests import utils as osc_lib_test_utils -from oslo_utils import importutils import wrapt from openstackclient import shell @@ -151,12 +151,13 @@ class TestShell(osc_lib_test_utils.TestShell): super(TestShell, self).setUp() # TODO(dtroyer): remove this once the shell_class_patch patch is # released in osc-lib - self.shell_class = importutils.import_class(self.shell_class_name) + mod_str, _sep, class_str = self.shell_class_name.rpartition('.') + self.shell_class = getattr(importlib.import_module(mod_str), class_str) def _assert_admin_token_auth(self, cmd_options, default_args): with mock.patch( - self.shell_class_name + ".initialize_app", - self.app, + self.shell_class_name + ".initialize_app", + self.app, ): _shell = osc_lib_test_utils.make_shell( shell_class=self.shell_class, |
