File tree Expand file tree Collapse file tree 5 files changed +97
-1
lines changed
Expand file tree Collapse file tree 5 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def init_registry(self, app):
108108 register_entry_point (
109109 self .request_type_registry , "invenio_requests.types" , app = app
110110 )
111- register_entry_point (self .request_type_registry , "invenio_requests.event_types" )
111+ register_entry_point (self .event_type_registry , "invenio_requests.event_types" )
112112 register_entry_point (
113113 self .entity_resolvers_registry , "invenio_requests.entity_resolvers"
114114 )
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2025 CERN.
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+ """Tests."""
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2025 CERN.
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+ """Mock module for registry tests."""
9+
10+ from invenio_users_resources .entity_resolvers import UserResolver
11+
12+ from invenio_requests .customizations import EventType , RequestType
13+
14+
15+ class MockRequestType (RequestType ):
16+ """Mock request type."""
17+
18+ type_id = "mock"
19+
20+
21+ class MockEventType (EventType ):
22+ """Mock event type."""
23+
24+ type_id = "M"
25+
26+
27+ class MockResolver (UserResolver ):
28+ """Mock entity resolver."""
29+
30+ type_id = "mock"
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2025 CERN.
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 CERN.
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