def test_canceller(pipeline): req_storage = storage.MemoryRequestsStorage() add_uid_assigner(pipeline) add_requests_saver(pipeline, req_storage) add_requests_canceller(pipeline, req_storage) requests_cancelled = [] add_cancelled_requests_notifier(pipeline, requests_cancelled) requests_not_cancelled = [] add_not_cancelled_requests_notifier(pipeline, requests_not_cancelled) pipeline.add_activity_request('john', 'coffee', 5, 0, 0) assert len(req_storage.get_activity_requests()) == 1 id_to_cancel = req_storage.get_activity_requests()[0].id pipeline.add_cancellation_request('john', id_to_cancel) assert len(req_storage.get_activity_requests()) == 0 assert len(requests_cancelled) == 1 assert len(requests_not_cancelled) == 0 pipeline.add_cancellation_request('john', id_to_cancel) assert len(req_storage.get_activity_requests()) == 0 assert len(requests_cancelled) == 1 assert len(requests_not_cancelled) == 1
def test_saver(pipeline): req_storage = storage.MemoryRequestsStorage() add_requests_saver(pipeline, req_storage) pipeline.add_activity_request('john', 'coffee', 5, 0, 0) assert req_storage.get_activity_requests()[0].person_id == 'john'
def test_memory_storage_resolves_and_fetches(): store = storage.MemoryRequestsStorage() storage_resolves_and_fetches(store)
def test_memory_storage_removes(): store = storage.MemoryRequestsStorage() storage_removes(store)
def test_memory_storage_filters_activities(): store = storage.MemoryRequestsStorage() storage_filters_activities(store)
def test_memory_storage_saves_and_restores(): store = storage.MemoryRequestsStorage() storage_saves_and_restores(store)
def test_memory_storage_understands_time(): store = storage.MemoryRequestsStorage() storage_understands_time(store)