コード例 #1
0
ファイル: test_object_markings.py プロジェクト: iskitsas/MISP
def test_clear_markings(data):
    before = data[0]
    after = data[1]

    before = markings.clear_markings(before, None)

    assert 'object_marking_refs' not in before
    assert 'object_marking_refs' not in after
コード例 #2
0
def test_clear_marking_not_present(data):
    """Test clearing markings for a selector that has no associated markings."""
    with pytest.raises(MarkingNotFoundError):
        data = markings.clear_markings(data, ["labels"])
コード例 #3
0
def test_clear_marking_bad_selector(data, selector):
    """Test bad selector raises exception."""
    with pytest.raises(InvalidSelectorError):
        markings.clear_markings(data, selector)
コード例 #4
0
def test_clear_marking_all_selectors(data):
    data = markings.clear_markings(data, ["description", "type", "modified"])
    assert markings.is_marked(data, "description") is False
    assert "granular_markings" not in data
コード例 #5
0
def test_clear_marking_one_selector(data):
    """Test markings associated with one selector were removed."""
    data = markings.clear_markings(data, "description")
    assert markings.is_marked(data, "description") is False
コード例 #6
0
def test_clear_marking_multiple_selectors(data):
    """Test clearing markings for multiple selectors effectively removes associated markings."""
    data = markings.clear_markings(data, ["type", "description"])
    assert markings.is_marked(data, ["type", "description"]) is False
コード例 #7
0
def test_clear_marking_smoke(data):
    """Test clear_marking call does not fail."""
    data = markings.clear_markings(data, "modified")
    assert markings.is_marked(data, "modified") is False