mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
More tests.
This commit is contained in:
parent
3e67d2d789
commit
797f34aec3
@ -696,7 +696,6 @@ class StorageClientMutables:
|
||||
Given a mapping between share numbers and test/write vectors, the tests
|
||||
are done and if they are valid the writes are done.
|
||||
"""
|
||||
# TODO unit test all the things
|
||||
url = self._client.relative_url(
|
||||
"/v1/mutable/{}/read-test-write".format(_encode_si(storage_index))
|
||||
)
|
||||
@ -731,7 +730,6 @@ class StorageClientMutables:
|
||||
"""
|
||||
Download a chunk of data from a share.
|
||||
"""
|
||||
# TODO unit test all the things
|
||||
return read_share_chunk(
|
||||
self._client, "mutable", storage_index, share_number, offset, length
|
||||
)
|
||||
@ -741,7 +739,6 @@ class StorageClientMutables:
|
||||
"""
|
||||
List the share numbers for a given storage index.
|
||||
"""
|
||||
# TODO unit test all the things
|
||||
url = self._client.relative_url(
|
||||
"/v1/mutable/{}/shares".format(_encode_si(storage_index))
|
||||
)
|
||||
|
@ -1271,10 +1271,41 @@ class MutableHTTPAPIsTests(SyncTestCase):
|
||||
)
|
||||
|
||||
def test_list_shares(self):
|
||||
pass
|
||||
"""``list_shares()`` returns the shares for a given storage index."""
|
||||
storage_index, _, _ = self.create_upload()
|
||||
self.assertEqual(result_of(self.mut_client.list_shares(storage_index)), {0, 1})
|
||||
|
||||
def test_non_existent_list_shares(self):
|
||||
"""A non-existent storage index errors when shares are listed."""
|
||||
with self.assertRaises(ClientException) as exc:
|
||||
result_of(self.mut_client.list_shares(urandom(32)))
|
||||
self.assertEqual(exc.exception.code, http.NOT_FOUND)
|
||||
|
||||
def test_wrong_write_enabler(self):
|
||||
pass
|
||||
"""Writes with the wrong write enabler fail, and are not processed."""
|
||||
storage_index, write_secret, lease_secret = self.create_upload()
|
||||
with self.assertRaises(ClientException) as exc:
|
||||
result_of(
|
||||
self.mut_client.read_test_write_chunks(
|
||||
storage_index,
|
||||
urandom(32),
|
||||
lease_secret,
|
||||
lease_secret,
|
||||
{
|
||||
0: TestWriteVectors(
|
||||
write_vectors=[WriteVector(offset=1, data=b"XYZ")]
|
||||
),
|
||||
},
|
||||
[ReadVector(0, 8)],
|
||||
)
|
||||
)
|
||||
self.assertEqual(exc.exception.code, http.UNAUTHORIZED)
|
||||
|
||||
# The write did not happen:
|
||||
self.assertEqual(
|
||||
result_of(self.mut_client.read_share_chunk(storage_index, 0, 0, 8)),
|
||||
b"abcdef-0",
|
||||
)
|
||||
|
||||
# TODO refactor reads tests so they're shared
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user