예제 #1
0
def test_task_hashes():
    essential_fields = ['content', 'tags']
    t1 = task(content='A')
    t2 = task(content='B', tags=None)
    t3 = task(content='B', tags=[])
    assert get_hash(t1, essential_fields) != get_hash(t2, essential_fields)
    assert get_hash(t2, essential_fields) == get_hash(t3, essential_fields)
예제 #2
0
def test_get_hash_essential_fields():
    id2 = task(content='foo', indent=2)
    id3 = task(content='foo', indent=3)
    assert get_hash(id2, essential_fields=['content']) == get_hash(
        id3, essential_fields=['content'])
    assert get_hash(id2, essential_fields=['content', 'indent']) != get_hash(
        id3, essential_fields=['content', 'indent'])
예제 #3
0
def test_task_hashes():
    essential_fields = ['content', 'tags']
    t1 = task(content='A')
    t2 = task(content='B', tags=None)
    t3 = task(content='B', tags=[])
    assert get_hash(t1, essential_fields) != get_hash(t2, essential_fields)
    assert get_hash(t2, essential_fields) == get_hash(t3, essential_fields)
예제 #4
0
def test_bridge_passes_tasks_through(td, gh, bridge):
    # add a task to the adapter
    foo = task(content='foo')
    bridge.push_task(td, 1, foo)

    # check how id mapping works
    mapping = ItemMapping.objects.bridge_get(bridge, left_id=1)
    assert mapping.left_hash == get_hash(foo, essential_fields=TASK_FIELDS)
    assert mapping.left_id == '1'
    assert gh.storage[mapping.right_id] == foo
예제 #5
0
def test_bridge_passes_tasks_through(td, gh, bridge):
    # add a task to the adapter
    foo = task(content='foo')
    bridge.push_task(td, 1, foo)

    # check how id mapping works
    mapping = ItemMapping.objects.bridge_get(bridge, left_id=1)
    assert mapping.left_hash == get_hash(foo, essential_fields=TASK_FIELDS)
    assert mapping.left_id == '1'
    assert gh.storage[mapping.right_id] == foo
예제 #6
0
def test_get_hash_essential_fields():
    id2 = task(content='foo', indent=2)
    id3 = task(content='foo', indent=3)
    assert get_hash(id2, essential_fields=['content']) == get_hash(id3, essential_fields=['content'])
    assert get_hash(id2, essential_fields=['content', 'indent']) != get_hash(id3, essential_fields=['content', 'indent'])