Merge "Make container list --all work"
This commit is contained in:
commit
831dd3fe12
@ -87,7 +87,7 @@ class APIv1(api.BaseAPI):
|
|||||||
|
|
||||||
def container_list(
|
def container_list(
|
||||||
self,
|
self,
|
||||||
all_data=False,
|
full_listing=False,
|
||||||
limit=None,
|
limit=None,
|
||||||
marker=None,
|
marker=None,
|
||||||
end_marker=None,
|
end_marker=None,
|
||||||
@ -96,7 +96,7 @@ class APIv1(api.BaseAPI):
|
|||||||
):
|
):
|
||||||
"""Get containers in an account
|
"""Get containers in an account
|
||||||
|
|
||||||
:param boolean all_data:
|
:param boolean full_listing:
|
||||||
if True, return a full listing, else returns a max of
|
if True, return a full listing, else returns a max of
|
||||||
10000 listings
|
10000 listings
|
||||||
:param integer limit:
|
:param integer limit:
|
||||||
@ -113,7 +113,7 @@ class APIv1(api.BaseAPI):
|
|||||||
|
|
||||||
params['format'] = 'json'
|
params['format'] = 'json'
|
||||||
|
|
||||||
if all_data:
|
if full_listing:
|
||||||
data = listing = self.container_list(
|
data = listing = self.container_list(
|
||||||
limit=limit,
|
limit=limit,
|
||||||
marker=marker,
|
marker=marker,
|
||||||
@ -299,7 +299,7 @@ class APIv1(api.BaseAPI):
|
|||||||
def object_list(
|
def object_list(
|
||||||
self,
|
self,
|
||||||
container=None,
|
container=None,
|
||||||
all_data=False,
|
full_listing=False,
|
||||||
limit=None,
|
limit=None,
|
||||||
marker=None,
|
marker=None,
|
||||||
end_marker=None,
|
end_marker=None,
|
||||||
@ -311,7 +311,7 @@ class APIv1(api.BaseAPI):
|
|||||||
|
|
||||||
:param string container:
|
:param string container:
|
||||||
container name to get a listing for
|
container name to get a listing for
|
||||||
:param boolean all_data:
|
:param boolean full_listing:
|
||||||
if True, return a full listing, else returns a max of
|
if True, return a full listing, else returns a max of
|
||||||
10000 listings
|
10000 listings
|
||||||
:param integer limit:
|
:param integer limit:
|
||||||
@ -332,7 +332,7 @@ class APIv1(api.BaseAPI):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
params['format'] = 'json'
|
params['format'] = 'json'
|
||||||
if all_data:
|
if full_listing:
|
||||||
data = listing = self.object_list(
|
data = listing = self.object_list(
|
||||||
container=container,
|
container=container,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
|
@ -30,8 +30,10 @@ FAKE_CONTAINER = 'rainbarrel'
|
|||||||
FAKE_OBJECT = 'spigot'
|
FAKE_OBJECT = 'spigot'
|
||||||
|
|
||||||
LIST_CONTAINER_RESP = [
|
LIST_CONTAINER_RESP = [
|
||||||
'qaz',
|
{"name": "qaz", "count": 0, "bytes": 0,
|
||||||
'fred',
|
"last_modified": "2020-05-16T05:52:07.377550"},
|
||||||
|
{"name": "fred", "count": 0, "bytes": 0,
|
||||||
|
"last_modified": "2020-05-16T05:55:07.377550"},
|
||||||
]
|
]
|
||||||
|
|
||||||
LIST_OBJECT_RESP = [
|
LIST_OBJECT_RESP = [
|
||||||
@ -117,34 +119,32 @@ class TestContainer(TestObjectAPIv1):
|
|||||||
)
|
)
|
||||||
self.assertEqual(LIST_CONTAINER_RESP, ret)
|
self.assertEqual(LIST_CONTAINER_RESP, ret)
|
||||||
|
|
||||||
# def test_container_list_full_listing(self):
|
def test_container_list_full_listing(self):
|
||||||
# sess = self.app.client_manager.session
|
self.requests_mock.register_uri(
|
||||||
#
|
'GET',
|
||||||
# def side_effect(*args, **kwargs):
|
FAKE_URL + '?limit=1&format=json',
|
||||||
# rv = sess.get().json.return_value
|
json=[LIST_CONTAINER_RESP[0]],
|
||||||
# sess.get().json.return_value = []
|
status_code=200,
|
||||||
# sess.get().json.side_effect = None
|
)
|
||||||
# return rv
|
self.requests_mock.register_uri(
|
||||||
#
|
'GET',
|
||||||
# resp = [{'name': 'is-name'}]
|
FAKE_URL +
|
||||||
# sess.get().json.return_value = resp
|
'?marker=%s&limit=1&format=json' % LIST_CONTAINER_RESP[0]['name'],
|
||||||
# sess.get().json.side_effect = side_effect
|
json=[LIST_CONTAINER_RESP[1]],
|
||||||
#
|
status_code=200,
|
||||||
# data = lib_container.list_containers(
|
)
|
||||||
# self.app.client_manager.session,
|
self.requests_mock.register_uri(
|
||||||
# fake_url,
|
'GET',
|
||||||
# full_listing=True,
|
FAKE_URL +
|
||||||
# )
|
'?marker=%s&limit=1&format=json' % LIST_CONTAINER_RESP[1]['name'],
|
||||||
#
|
json=[],
|
||||||
# # Check expected values
|
status_code=200,
|
||||||
# sess.get.assert_called_with(
|
)
|
||||||
# fake_url,
|
ret = self.api.container_list(
|
||||||
# params={
|
limit=1,
|
||||||
# 'format': 'json',
|
full_listing=True,
|
||||||
# 'marker': 'is-name',
|
)
|
||||||
# }
|
self.assertEqual(LIST_CONTAINER_RESP, ret)
|
||||||
# )
|
|
||||||
# self.assertEqual(resp, data)
|
|
||||||
|
|
||||||
def test_container_show(self):
|
def test_container_show(self):
|
||||||
headers = {
|
headers = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user