Example #1
0
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
Example #2
0
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'
Example #3
0
def test_memory_storage_resolves_and_fetches():
    store = storage.MemoryRequestsStorage()
    storage_resolves_and_fetches(store)
Example #4
0
def test_memory_storage_removes():
    store = storage.MemoryRequestsStorage()
    storage_removes(store)
Example #5
0
def test_memory_storage_filters_activities():
    store = storage.MemoryRequestsStorage()
    storage_filters_activities(store)
Example #6
0
def test_memory_storage_saves_and_restores():
    store = storage.MemoryRequestsStorage()
    storage_saves_and_restores(store)
Example #7
0
def test_memory_storage_understands_time():
    store = storage.MemoryRequestsStorage()
    storage_understands_time(store)