Skip to content

Commit

Permalink
doi model (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta authored Sep 27, 2024
1 parent 676cac7 commit 770338e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions oarepo_model_builder/builtin_models/doi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"service-config": {
"components": [
"{{oarepo_doi.services.components.DoiComponent}}"
]
}
}
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ oarepo_model_builder.datatypes.components =
# models are generic, same for all profiles
oarepo.models =
invenio = oarepo_model_builder.builtin_models:invenio.json
doi = oarepo_model_builder.builtin_models:doi.json


# outputs are generic, profile independent
Expand Down
39 changes: 39 additions & 0 deletions tests/test_include_doi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
import re

from oarepo_model_builder.entrypoints import create_builder_from_entrypoints, load_model
from oarepo_model_builder.fs import InMemoryFileSystem

from .utils import strip_whitespaces

OAREPO_USE = "use"



def test_include_invenio():
schema = load_model(
"test.yaml", # NOSONAR
model_content={
"version": "1.0.0",

"record": {
"module": {"qualified": "test"},
OAREPO_USE: ["invenio", "doi"],
"properties": {"a": {"type": "keyword", "required": True}},
},
},
isort=False,
black=False,
autoflake=False,
)

filesystem = InMemoryFileSystem()
builder = create_builder_from_entrypoints(filesystem=filesystem)

builder.build(schema, "record", ["record"], "")

data = builder.filesystem.open(
os.path.join("test", "services", "records", "config.py")
).read()
data = str(data)
assert "components=[*PermissionsPresetsConfigMixin.components,*InvenioRecordServiceConfig.components,DoiComponent]" in re.sub(r"\s", "", data)

0 comments on commit 770338e

Please sign in to comment.