def test_do_image_show(self):
        args = self._make_args({"id": "pass", "page_size": 18, "max_column_width": 120})
        with mock.patch.object(self.gc.images, "get") as mocked_list:
            ignore_fields = ["self", "access", "file", "schema"]
            expect_image = dict([(field, field) for field in ignore_fields])
            expect_image["id"] = "pass"
            mocked_list.return_value = expect_image

            test_shell.do_image_show(self.gc, args)

            mocked_list.assert_called_once_with("pass")
            utils.print_dict.assert_called_once_with({"id": "pass"}, max_column_width=120)
    def test_do_image_show(self):
        args = self._make_args({'id': 'pass', 'page_size': 18})
        with mock.patch.object(self.gc.images, 'get') as mocked_list:
            ignore_fields = ['self', 'access', 'file', 'schema']
            expect_image = dict([(field, field) for field in ignore_fields])
            expect_image['id'] = 'pass'
            mocked_list.return_value = expect_image

            test_shell.do_image_show(self.gc, args)

            mocked_list.assert_called_once_with('pass')
            utils.print_dict.assert_called_once_with({'id': 'pass'})
Exemple #3
0
    def test_do_image_show(self):
        args = self._make_args({'id': 'pass', 'page_size': 18})
        with mock.patch.object(self.gc.images, 'get') as mocked_list:
            ignore_fields = ['self', 'access', 'file', 'schema']
            expect_image = dict([(field, field) for field in ignore_fields])
            expect_image['id'] = 'pass'
            mocked_list.return_value = expect_image

            test_shell.do_image_show(self.gc, args)

            mocked_list.assert_called_once_with('pass')
            utils.print_dict.assert_called_once_with({'id': 'pass'})
    def test_do_image_show(self):
        args = self._make_args({'id': 'pass', 'page_size': 18,
                                'human_readable': False,
                                'max_column_width': 120})
        with mock.patch.object(self.gc.images, 'get') as mocked_list:
            ignore_fields = ['self', 'access', 'file', 'schema']
            expect_image = dict([(field, field) for field in ignore_fields])
            expect_image['id'] = 'pass'
            expect_image['size'] = 1024
            mocked_list.return_value = expect_image

            test_shell.do_image_show(self.gc, args)

            mocked_list.assert_called_once_with('pass')
            utils.print_dict.assert_called_once_with({'id': 'pass',
                                                      'size': 1024},
                                                     max_column_width=120)
    def test_do_image_show(self):
        args = self._make_args({'id': 'pass', 'page_size': 18,
                                'human_readable': False,
                                'max_column_width': 120})
        with mock.patch.object(self.gc.images, 'get') as mocked_list:
            ignore_fields = ['self', 'access', 'file', 'schema']
            expect_image = dict([(field, field) for field in ignore_fields])
            expect_image['id'] = 'pass'
            expect_image['size'] = 1024
            mocked_list.return_value = expect_image

            test_shell.do_image_show(self.gc, args)

            mocked_list.assert_called_once_with('pass')
            utils.print_dict.assert_called_once_with({'id': 'pass',
                                                      'size': 1024},
                                                     max_column_width=120)
    def test_do_image_show(self):
        gc = client.Client('1', 'http://no.where')

        class Fake():
            def __init__(self):
                self.page_size = 18
                self.id = 'pass'

        with mock.patch.object(gc.images, 'get') as mocked_list:
            mocked_list.return_value = {}
            actual = test_shell.do_image_show(gc, Fake())
Exemple #7
0
    def test_do_image_show(self):
        gc = client.Client('1', 'http://is.invalid')

        class Fake():
            def __init__(self):
                self.page_size = 18
                self.id = 'pass'

        with mock.patch.object(gc.images, 'get') as mocked_list:
            mocked_list.return_value = {}
            actual = test_shell.do_image_show(gc, Fake())