Пример #1
0
def test_add_tags(app):
    tags = ["test", "tag", "three"]
    test_scope = ScopeItem(target="127.0.0.1/8", blacklist=False)
    db.session.add(test_scope)
    ScopeItem.addTags(test_scope, tags)
    for tag in test_scope.tags:
        assert test_scope.is_tagged(tag)
Пример #2
0
def test_del_tags(app):
    tags = ["test", "tags", "three"]
    test_scope = ScopeItem(target="127.0.0.1/8", blacklist=False)
    db.session.add(test_scope)
    ScopeItem.addTags(test_scope, tags)
    assert len([t.name for t in test_scope.tags]) == 3
    test_scope.delTag(test_scope.tags[2])
    assert len([t.name for t in test_scope.tags]) == 2