mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 00:24:13 +00:00
Test and document what happens for non-existent storage index.
This commit is contained in:
parent
35bbcad4de
commit
70d0bd0597
@ -635,6 +635,9 @@ indicated storage index. For example::
|
||||
|
||||
[1, 5]
|
||||
|
||||
An unknown storage index results in empty list, so that lack of existence of
|
||||
storage index is not leaked.
|
||||
|
||||
``GET /v1/immutable/:storage_index/:share_number``
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
@ -266,8 +266,6 @@ class HTTPServer(object):
|
||||
List shares for the given storage index.
|
||||
"""
|
||||
storage_index = si_a2b(storage_index.encode("ascii"))
|
||||
|
||||
# TODO in future ticket, handle KeyError as 404
|
||||
share_numbers = list(self._storage_server.get_buckets(storage_index).keys())
|
||||
return self._cbor(request, share_numbers)
|
||||
|
||||
|
@ -413,6 +413,14 @@ class ImmutableHTTPAPITests(SyncTestCase):
|
||||
# Now shares 1 and 3 exist:
|
||||
self.assertEqual(result_of(im_client.list_shares(storage_index)), {1, 3})
|
||||
|
||||
def test_list_shares_unknown_storage_index(self):
|
||||
"""
|
||||
Listing unknown storage index's shares results in empty list of shares.
|
||||
"""
|
||||
im_client = StorageClientImmutables(self.http.client)
|
||||
storage_index = b"".join(bytes([i]) for i in range(16))
|
||||
self.assertEqual(result_of(im_client.list_shares(storage_index)), set())
|
||||
|
||||
def test_multiple_shares_uploaded_to_different_place(self):
|
||||
"""
|
||||
If a storage index has multiple shares, uploads to different shares are
|
||||
|
Loading…
x
Reference in New Issue
Block a user