Esempio n. 1
0
    def test_list_non_empty(self, client):
        base_path = '/path/'
        # Create some files to return
        dir_prefix = BlobPrefix()
        dir_prefix.name = base_path + 'dir'

        blob_props = BlobProperties()
        blob_props.content_length = 42
        blob = Blob(base_path + 'file', props=blob_props)

        client.return_value.list_blobs.return_value = MockBlobList([dir_prefix, blob])

        store = AzureStore()
        key_path = self.wasbs_base + base_path
        results = store.list(key=key_path)
        assert len(results['blobs']) == 1
        assert len(results['prefixes']) == 1
        assert results['prefixes'][0] == 'dir'
        assert results['blobs'][0][0] == 'file'
        assert results['blobs'][0][1] == 42
Esempio n. 2
0
    def test_list_empty(self, client):
        client.return_value.list_blobs.return_value = MockBlobList([])

        store = AzureStore()
        key_path = self.wasbs_base + 'path'
        assert store.list(key=key_path) == {'blobs': [], 'prefixes': []}