def generate_sync_link(display_name, storage_id, capacity=1000): """Return a dummy sync link.""" sync_link = mock.Mock(SynchronizationLink) sync_link.local = mock.Mock(BasicStorage) sync_link.remote = mock.Mock(BasicStorage) sync_link.remote.storage_id = storage_id metrics = ThreadingFuture() metrics.set(StorageMetrics(storage_id, capacity, display_name=display_name)) sync_link.metrics = metrics sync_engine = mock.MagicMock(SyncEngine) sync_engine.query().get.return_value = {} sync_link.sync_engine = sync_engine return sync_link
def test_future_nested_future(future): inner_future = ThreadingFuture() inner_future.set("foo") outer_future = ThreadingFuture() outer_future.set(inner_future) assert outer_future.get().get() == "foo"