File tree Expand file tree Collapse file tree 4 files changed +84
-2
lines changed
Expand file tree Collapse file tree 4 files changed +84
-2
lines changed Original file line number Diff line number Diff line change 44# Copyright (C) 2021 Northwestern University.
55# Copyright (C) 2021 TU Wien.
66# Copyright (C) 2023 Graz University of Technology.
7+ # Copyright (C) 2025 CESNET i.a.l.e.
78#
89# Invenio-Requests is free software; you can redistribute it and/or modify it
910# under the terms of the MIT License; see LICENSE file for more details.
@@ -108,7 +109,7 @@ def init_registry(self, app):
108109 register_entry_point (
109110 self .request_type_registry , "invenio_requests.types" , app = app
110111 )
111- register_entry_point (self .request_type_registry , "invenio_requests.event_types" )
112+ register_entry_point (self .event_type_registry , "invenio_requests.event_types" )
112113 register_entry_point (
113114 self .entity_resolvers_registry , "invenio_requests.entity_resolvers"
114115 )
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22#
33# Copyright (C) 2025 Northwestern University.
4+ # Copyright (C) 2025 CESNET i.a.l.e.
45#
56# Invenio-Requests is free software; you can redistribute it and/or modify it
67# under the terms of the MIT License; see LICENSE file for more details.
78
8- """Mock module."""
9+ """Mock module for registry tests."""
10+
11+ from invenio_users_resources .entity_resolvers import UserResolver
12+
13+ from invenio_requests .customizations import EventType , RequestType
14+
15+
16+ class MockRequestType (RequestType ):
17+ """Mock request type."""
18+
19+ type_id = "mock"
20+
21+
22+ class MockEventType (EventType ):
23+ """Mock event type."""
24+
25+ type_id = "M"
26+
27+
28+ class MockResolver (UserResolver ):
29+ """Mock entity resolver."""
30+
31+ type_id = "mock"
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2025 CESNET i.a.l.e.
4+ #
5+ # Invenio-Requests is free software; you can redistribute it and/or modify it
6+ # under the terms of the MIT License; see LICENSE file for more details.
7+
8+ """App fixture with test entrypoints."""
9+
10+ import pytest
11+ from invenio_app .factory import create_api
12+
13+
14+ @pytest .fixture (scope = "module" )
15+ def create_app (instance_path , entry_points ):
16+ """Application factory fixture."""
17+ return create_api
18+
19+
20+ @pytest .fixture (scope = "module" )
21+ def extra_entry_points ():
22+ """Extra entry points to load the mock_module features."""
23+ return {
24+ "invenio_requests.types" : [
25+ "mock_module = tests.mock_module:MockRequestType" ,
26+ ],
27+ "invenio_requests.event_types" : [
28+ "mock_module = tests.mock_module:MockEventType" ,
29+ ],
30+ "invenio_requests.entity_resolvers" : [
31+ "mock_module = tests.mock_module:MockResolver" ,
32+ ],
33+ }
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2025 CESNET i.a.l.e.
4+ #
5+ # Invenio-Requests is free software; you can redistribute it and/or modify it
6+ # under the terms of the MIT License; see LICENSE file for more details.
7+
8+ """Test for entrypoint loading."""
9+
10+ from tests .mock_module import MockEventType , MockRequestType , MockResolver
11+
12+
13+ def test_request_type_registry_entrypoints (app ):
14+ registry = app .extensions ["invenio-requests" ].request_type_registry
15+ assert isinstance (registry .lookup ("mock" ), MockRequestType )
16+
17+
18+ def test_event_type_registry_entrypoints (app ):
19+ registry = app .extensions ["invenio-requests" ].event_type_registry
20+ assert isinstance (registry .lookup ("M" ), MockEventType )
21+
22+
23+ def test_entity_resolvers_registry_entrypoints (app ):
24+ registry = app .extensions ["invenio-requests" ].entity_resolvers_registry
25+ assert isinstance (registry .lookup ("mock" ), MockResolver )
You can’t perform that action at this time.
0 commit comments