Support to get all tags

This commit is contained in:
WQY\qiong
2023-04-05 23:39:07 +08:00
parent 5f64439f9f
commit b0c90fcc07
4 changed files with 35 additions and 3 deletions

View File

@@ -1998,10 +1998,19 @@ class TestApi:
t = get_tag(p, TAG_TYPE_NODE, 'j1')
assert t['tag'] == 'j1t'
tags = get_tags(p)
assert len(tags) == 1
assert tags[0]['t_type'] == TAG_TYPE_NODE
assert tags[0]['id'] == 'j1'
assert tags[0]['tag'] == 'j1t'
set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': None }))
t = get_tag(p, TAG_TYPE_NODE, 'j1')
assert t['tag'] == None
tags = get_tags(p)
assert len(tags) == 0
t = get_tag(p, TAG_TYPE_NODE, 'j2')
assert t['tag'] == None
set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j2', 'tag': 'j2t' }))
@@ -2014,6 +2023,15 @@ class TestApi:
t = get_tag(p, TAG_TYPE_LINK, 'p0')
assert t['tag'] == 'p0t'
tags = get_tags(p)
assert len(tags) == 2
assert tags[0]['t_type'] == TAG_TYPE_NODE
assert tags[0]['id'] == 'j2'
assert tags[0]['tag'] == 'j2t'
assert tags[1]['t_type'] == TAG_TYPE_LINK
assert tags[1]['id'] == 'p0'
assert tags[1]['tag'] == 'p0t'
self.leave(p)