def fs_source():
    # create
    fs = stix2.FileSystemSource(FS_PATH)
    assert fs.stix_dir == FS_PATH
    yield fs

    # remove campaign dir
    shutil.rmtree(os.path.join(FS_PATH, "campaign"), True)
Beispiel #2
0
def test_graph_equivalence_with_filesystem_source(ds):
    weights = {
        "_internal": {
            "ignore_spec_version": True,
            "versioning_checks": False,
            "max_depth": 1,
        },
    }
    prop_scores = {}
    fs = stix2.FileSystemSource(FS_PATH)
    env = stix2.Environment().graphically_equivalent(fs, ds, prop_scores, **weights)
    assert round(env) == 28
    assert round(prop_scores["matching_score"]) == 139
    assert round(prop_scores["sum_weights"]) == 500
def test_filesystem_source_nonexistent_folder():
    with pytest.raises(ValueError):
        stix2.FileSystemSource('nonexistent-folder')
Beispiel #4
0
def test_filesystem_source_nonexistent_folder():
    with pytest.raises(ValueError) as excinfo:
        stix2.FileSystemSource('nonexistent-folder')
    assert "for STIX data does not exist" in str(excinfo)
Beispiel #5
0
def fs():
    yield stix2.FileSystemSource(FS_PATH)