Ejemplo n.º 1
0
def test_validate(tmp_trestle_dir: pathlib.Path) -> None:
    """Test validate model."""
    # create a model
    catalog_data = generators.generate_sample_model(cat.Catalog)
    repo = Repository(tmp_trestle_dir)
    repo.import_model(catalog_data, 'imported')
    success = repo.validate_model(cat.Catalog, 'imported')
    assert success
Ejemplo n.º 2
0
def test_validate_model_not_exists(tmp_trestle_dir: pathlib.Path) -> None:
    """Assemble model does not exists."""
    repo = Repository(tmp_trestle_dir)
    success = repo.validate_model(cat.Catalog, 'anything')
    assert not success
Ejemplo n.º 3
0
def test_validate_invalid_top_model(tmp_trestle_dir: pathlib.Path) -> None:
    """Invalid top model."""
    repo = Repository(tmp_trestle_dir)
    with pytest.raises(TrestleError, match='not a top level model'):
        repo.validate_model(oscal.common.Metadata, 'anything')