def test_fires_callbacks_data_received(): progress = ProgressListener(upload_id='foo') cb = mock.Mock() progress.register_callback(cb) progress.data_received(42) assert len(cb.mock_calls) == 1 _, call_args, call_kwargs = cb.mock_calls[0] state = call_args[0] assert not state['files'] assert state['total'] == [42, None]