Add control api and test
This commit is contained in:
@@ -1206,6 +1206,7 @@ class TestApi:
|
||||
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_tag_op(self):
|
||||
p = 'test_tag_op'
|
||||
self.enter(p)
|
||||
@@ -1219,36 +1220,42 @@ class TestApi:
|
||||
assert is_pipe(p, 'p0')
|
||||
|
||||
cs = set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' })).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_NODE
|
||||
assert cs['id'] == 'j1'
|
||||
assert cs['tag'] == 'j1t'
|
||||
|
||||
cs = execute_undo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_NODE
|
||||
assert cs['id'] == 'j1'
|
||||
assert cs['tag'] == None
|
||||
|
||||
cs = execute_redo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_NODE
|
||||
assert cs['id'] == 'j1'
|
||||
assert cs['tag'] == 'j1t'
|
||||
|
||||
cs = set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' })).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_LINK
|
||||
assert cs['id'] == 'p0'
|
||||
assert cs['tag'] == 'p0t'
|
||||
|
||||
cs = execute_undo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_LINK
|
||||
assert cs['id'] == 'p0'
|
||||
assert cs['tag'] == None
|
||||
|
||||
cs = execute_redo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'tag'
|
||||
assert cs['t_type'] == TAG_TYPE_LINK
|
||||
assert cs['id'] == 'p0'
|
||||
@@ -1257,6 +1264,40 @@ class TestApi:
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_control(self):
|
||||
p = 'test_control'
|
||||
self.enter(p)
|
||||
|
||||
assert get_control(p)['control'] == ''
|
||||
|
||||
set_control(p, ChangeSet({'control': 'x'}))
|
||||
assert get_control(p)['control'] == 'x'
|
||||
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_control_op(self):
|
||||
p = 'test_control_op'
|
||||
self.enter(p)
|
||||
|
||||
cs = set_control(p, ChangeSet({'control': 'x'})).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'control'
|
||||
assert cs['control'] == 'x'
|
||||
|
||||
cs = execute_undo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'control'
|
||||
assert cs['control'] == ''
|
||||
|
||||
cs = execute_redo(p).operations[0]
|
||||
assert cs['operation'] == API_UPDATE
|
||||
assert cs['type'] == 'control'
|
||||
assert cs['control'] == 'x'
|
||||
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_demand(self):
|
||||
p = 'test_demand'
|
||||
self.enter(p)
|
||||
|
||||
Reference in New Issue
Block a user