Skip to content

Commit

Permalink
Merge pull request #394 from CSCfi/bugfix/last-bucket-refresh
Browse files Browse the repository at this point in the history
Return empty list of buckets, fixes #356
blankdots authored Nov 24, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 2434fc7 + 18e8940 commit 854a6a6
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 0 additions & 5 deletions swift_browser_ui/ui/api.py
Original file line number Diff line number Diff line change
@@ -67,11 +67,6 @@ async def swift_list_buckets(request: aiohttp.web.Request) -> aiohttp.web.Respon
# response at once
serv = request.app["Sessions"][session]["ST_conn"].list()
[_unpack(i, cont, request) for i in serv]
# for a bucket with no objects
if not cont:
# return empty object
request.app["Log"].debug("Empty container list.")
raise aiohttp.web.HTTPNotFound()
return aiohttp.web.json_response(cont)
except SwiftError:
request.app["Log"].error("SwiftError occured return empty container list.")
7 changes: 4 additions & 3 deletions tests/ui_unit/test_api.py
Original file line number Diff line number Diff line change
@@ -107,10 +107,11 @@ async def test_list_objects_with_unicode_nulls(self):
)

async def test_list_without_containers(self):
"""Test function list buckets on a project without object storage."""
"""Test function list buckets on a project without containers."""
self.request.app["Sessions"][self.cookie]["ST_conn"].init_with_data(containers=0)
with self.assertRaises(HTTPNotFound):
_ = await swift_list_buckets(self.request)
response = await swift_list_buckets(self.request)
objects = json.loads(response.text)
self.assertEqual(objects, [])

async def test_list_with_invalid_container(self):
"""Test function list objects with an invalid container id."""

0 comments on commit 854a6a6

Please sign in to comment.