Exemplo n.º 1
0
def test_to_dict_cache():
    from corecluster.cache.task import Task
    t = Task()
    t.set_prop('x', 1)
    t.set_prop('y', 2)
    d = t.to_dict
    assert 'data' in d
    assert 'type' in d
    assert 'action' in d
Exemplo n.º 2
0
def test_set_prop_cache():
    from corecluster.cache.task import Task
    t = Task()
    t.set_prop('x', 1)
    t.set_prop('y', 2)
    assert t.get_prop('x') == 1
    assert t.get_prop('y') == 2

    t.set_all_props({'a': 1, 'b': 2})
    props = t.get_all_props()
    assert 'a' in props
    assert 'b' in props
    assert 'x' not in props
    assert 'y' not in props