Skip to content

Commit

Permalink
moved test code to pytest-oarepo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Krist committed Jan 13, 2025
1 parent 6f13e9a commit 56ee372
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 510 deletions.
7 changes: 4 additions & 3 deletions oarepo_communities/cf/workflows.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import marshmallow as ma
from flask import current_app
from invenio_records_resources.services.custom_fields import KeywordCF
#---
from typing import Any


def validate_workflow(value):
def validate_workflow(value: str)->bool:
return value in current_app.config["WORKFLOWS"]


class WorkflowSchemaField(ma.fields.Str):
def __init__(self, **kwargs) -> None:
def __init__(self, **kwargs: Any) -> None:
super().__init__(validate=[validate_workflow], **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion oarepo_communities/resources/community_records/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create_in_community(self) -> tuple[dict, int]:
if "model" in resource_requestctx.view_args
else None
)
item = self.service.create_in_community(
item = self.service.create(
identity=g.identity,
community_id=resource_requestctx.view_args["pid_value"],
data=resource_requestctx.data,
Expand Down
4 changes: 2 additions & 2 deletions oarepo_communities/services/community_records/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ def user_search_model(
)

@unit_of_work()
def create_in_community(
def create(
self,
identity: Identity,
community_id: str,
data: dict[str, Any],
community_id: str,
model: str = None,
uow: UnitOfWork | None = None,
expand: bool = False,
Expand Down
Loading

0 comments on commit 56ee372

Please sign in to comment.