forked from inveniosoftware/invenio-rdm-records
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
59 lines (49 loc) · 2.06 KB
/
Copy pathconftest.py
File metadata and controls
59 lines (49 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2021 CERN.
# Copyright (C) 2019-2021 Northwestern University.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Pytest configuration.
See https://pytest-invenio.readthedocs.io/ for documentation on which test
fixtures are available.
"""
import pytest
from invenio_app.factory import create_api
from invenio_indexer.api import RecordIndexer
from invenio_rdm_records.records.api import RDMDraft
@pytest.fixture(scope="module")
def extra_entry_points():
"""Extra entry points to load the mock_module features."""
return {
"invenio_administration.views": [
"invenio_app_rdm_records_list = tests.mock_module.administration:RecordAdminListView",
"invenio_app_rdm_drafts_list = tests.mock_module.administration:DraftAdminListView",
"invenio_requests_user_moderation_list = tests.mock_module.administration:UserModerationListView",
],
"invenio_base.blueprints": [
"invenio_app_rdm_records = tests.mock_module:create_invenio_app_rdm_records_blueprint", # noqa
"invenio_app_rdm_requests = tests.mock_module:create_invenio_app_rdm_requests_blueprint", # noqa
"invenio_app_rdm_communities = tests.mock_module:create_invenio_app_rdm_communities_blueprint", # noqa
],
"invenio_db.model": [
"mock_module = tests.records.mock_module.models",
],
"invenio_jsonschemas.schemas": [
"mock_module = tests.records.mock_module.jsonschemas",
],
"invenio_search.mappings": [
"mocks = tests.records.mock_module.mappings",
],
}
@pytest.fixture(scope="module")
def create_app(instance_path, entry_points):
"""Application factory fixture."""
return create_api
@pytest.fixture()
def indexer():
"""Indexer instance with correct Record class."""
return RecordIndexer(
record_cls=RDMDraft, record_to_index=lambda r: (r.index._name, "_doc")
)