예제 #1
0
    def test_do_image_list_with_changes_since(self):
        input = {
            'name': None,
            'limit': None,
            'status': None,
            'container_format': 'bare',
            'size_min': None,
            'size_max': None,
            'is_public': True,
            'disk_format': 'raw',
            'page_size': 20,
            'visibility': True,
            'member_status': 'Fake',
            'owner': 'test',
            'checksum': 'fake_checksum',
            'tag': 'fake tag',
            'properties': [],
            'sort_key': None,
            'sort_dir': None,
            'all_tenants': False,
            'human_readable': True,
            'changes_since': '2011-1-1'
        }
        args = self._make_args(input)
        with mock.patch.object(self.gc.images, 'list') as mocked_list:
            mocked_list.return_value = {}

            v1shell.do_image_list(self.gc, args)

            exp_img_filters = {
                'container_format': 'bare',
                'changes-since': '2011-1-1',
                'disk_format': 'raw',
                'is_public': True
            }
            mocked_list.assert_called_once_with(sort_dir=None,
                                                sort_key=None,
                                                owner='test',
                                                page_size=20,
                                                filters=exp_img_filters)
예제 #2
0
    def test_do_image_list_with_changes_since(self):
        input = {
            'name': None,
            'limit': None,
            'status': None,
            'container_format': 'bare',
            'size_min': None,
            'size_max': None,
            'is_public': True,
            'disk_format': 'raw',
            'page_size': 20,
            'visibility': True,
            'member_status': 'Fake',
            'owner': 'test',
            'checksum': 'fake_checksum',
            'tag': 'fake tag',
            'properties': [],
            'sort_key': None,
            'sort_dir': None,
            'all_tenants': False,
            'human_readable': True,
            'changes_since': '2011-1-1'
        }
        args = self._make_args(input)
        with mock.patch.object(self.gc.images, 'list') as mocked_list:
            mocked_list.return_value = {}

            v1shell.do_image_list(self.gc, args)

            exp_img_filters = {'container_format': 'bare',
                               'changes-since': '2011-1-1',
                               'disk_format': 'raw',
                               'is_public': True}
            mocked_list.assert_called_once_with(sort_dir=None,
                                                sort_key=None,
                                                owner='test',
                                                page_size=20,
                                                filters=exp_img_filters)
예제 #3
0
 def test_is_public_list(self):
     shell.do_image_list(self.gc, FakeArg({"is_public": "True"}))
     parts = parse.urlparse(self.api.url)
     qs_dict = parse.parse_qs(parts.query)
     self.assertTrue('is_public' in qs_dict)
     self.assertTrue(qs_dict['is_public'][0].lower() == "true")
예제 #4
0
 def test_is_public_list(self):
     shell.do_image_list(self.gc, FakeArg({"is_public": "True"}))
     parts = parse.urlparse(self.api.url)
     qs_dict = parse.parse_qs(parts.query)
     self.assertTrue('is_public' in qs_dict)
     self.assertTrue(qs_dict['is_public'][0].lower() == "true")