def test_removal_of_multiple_cleanups_for_same_url(self, transport): callbacks = ClenaupCallbacks() client = Client(transport) client.add_cleanup('/foo', callbacks.cleanup1) client.add_cleanup('/foo', callbacks.cleanup2) client.remove_cleanup('/foo') client.cleanup() assert callbacks.calls == []
def test_removing_cleanup_callback(self, transport): class Callbacks: def __init__(self): self.calls = [] def cleanup1(self): self.calls.append('cleanup1') def cleanup2(self): self.calls.append('cleanup2') callbacks = Callbacks() client = Client(transport) client.add_cleanup('/foo', callbacks.cleanup1) client.add_cleanup('/bar', callbacks.cleanup2) client.remove_cleanup('/foo') client.cleanup() assert sorted(callbacks.calls) == sorted(['cleanup2'])