Skip to content

Commit

Permalink
test(forms): add test-namespaced ui resource config
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekys committed Feb 27, 2024
1 parent 833b816 commit 7bbdf65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ def record_ui_resource(app, record_ui_resource_config, record_service):
)
return ui_resource

@pytest.fixture(scope="module")
def test_record_ui_resource_config():
config = ModelUIResourceConfig()
config.search_app_id = 'Test'
config.form_app_id = 'Test'


@pytest.fixture(scope="module")
def test_record_ui_resource(app, test_record_ui_resource_config, record):
ui_resource = ModelUIResource(test_record_ui_resource_config)
app.register_blueprint(
ui_resource.as_blueprint(template_folder=Path(__file__).parent / "templates")
)
return ui_resource


@pytest.fixture(scope="module")
def titlepage_ui_resource(
Expand Down
11 changes: 5 additions & 6 deletions tests/test_ui_resource_config.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
from invenio_access.permissions import system_identity


def test_ui_resource_form_config(app, record_ui_resource):
fc = record_ui_resource.config.form_config()
def test_ui_resource_form_config(app, test_record_ui_resource):
# Special instance of record resource
fc = test_record_ui_resource.config.form_config()
assert fc == dict(
custom_fields={"ui": {}},
overridableIdPrefix='Test.Form',
)

record_ui_resource.form_app_id = 'Test'

record_ui_resource.run_components(
test_record_ui_resource.run_components(
"form_config",
form_config=fc,
layout="",
resource=record_ui_resource,
resource=test_record_ui_resource,
api_record=None,
record={},
data={},
Expand Down

0 comments on commit 7bbdf65

Please sign in to comment.