def test_delete(tmp_trestle_dir: pathlib.Path) -> None:
    """Test delete model."""
    # create a model
    catalog_data = generators.generate_sample_model(cat.Catalog)
    repo = Repository(tmp_trestle_dir)
    repo.import_model(catalog_data, 'imported')
    # created model is 'dist' folder also
    repo.assemble_model(cat.Catalog, 'imported')
    success = repo.delete_model(cat.Catalog, 'imported')
    assert success
def test_delete_model_not_exists(tmp_trestle_dir: pathlib.Path) -> None:
    """Delete model does not exists."""
    repo = Repository(tmp_trestle_dir)
    with pytest.raises(TrestleError, match='does not exist'):
        repo.delete_model(cat.Catalog, 'anything')
def test_delete_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.delete_model(oscal.common.Metadata, 'anything')