diff options
author | Victor Shyba <victor1984@riseup.net> | 2017-09-15 20:05:07 -0300 |
---|---|---|
committer | Victor Shyba <victor1984@riseup.net> | 2017-10-05 05:41:40 -0300 |
commit | 4fa10253527d67ab687d8f44a1c72ab6975a9778 (patch) | |
tree | ed239f6c2f5c9b6f08b0e8fa774d81bb00f6a254 /tests/blobs/test_blob_manager.py | |
parent | 30a707786dfe9fb68855fad489817efed0d0b329 (diff) |
[feature] filter out unavailable blobs on listing
-- Related: #8822
Diffstat (limited to 'tests/blobs/test_blob_manager.py')
-rw-r--r-- | tests/blobs/test_blob_manager.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/blobs/test_blob_manager.py b/tests/blobs/test_blob_manager.py index 995a1989..0fcfff72 100644 --- a/tests/blobs/test_blob_manager.py +++ b/tests/blobs/test_blob_manager.py @@ -174,3 +174,22 @@ class BlobManagerTestCase(unittest.TestCase): failed_upload = SyncStatus.FAILED_UPLOAD local_list = yield self.manager.local_list(sync_status=failed_upload) self.assertIn(blob_id, local_list) + + @defer.inlineCallbacks + @pytest.mark.usefixtures("method_tmpdir") + def test_local_list_doesnt_include_unavailable_blobs(self): + local = self.manager.local + unavailable_ids, deferreds = [], [] + for unavailable_status in SyncStatus.UNAVAILABLE_STATUSES: + current_blob_id = uuid4().hex + deferreds.append(local.put(current_blob_id, BytesIO(''), 0, + status=unavailable_status)) + unavailable_ids.append(current_blob_id) + available_blob_id = uuid4().hex + content, length = self.cleartext, len(self.cleartext.getvalue()) + deferreds.append(local.put(available_blob_id, content, length)) + yield defer.gatherResults(deferreds) + local_list = yield local.list() + message = 'Unavailable blob showing up on listing!' + for blob_id in unavailable_ids: + self.assertNotIn(blob_id, local_list, message) |