From eafb4695d00e635ec3cc4ab390c1bce7b50c65b4 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Fri, 3 Nov 2023 14:19:51 -0300 Subject: [PATCH] Small updates for issues found in manual testing. --- api/admin/controller/integration_settings.py | 7 ++++--- api/odl2.py | 2 +- core/opds_import.py | 8 ++++---- tests/api/admin/controller/test_patron_auth.py | 1 - 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/admin/controller/integration_settings.py b/api/admin/controller/integration_settings.py index b84deb2f25..b84fd1ac93 100644 --- a/api/admin/controller/integration_settings.py +++ b/api/admin/controller/integration_settings.py @@ -64,7 +64,7 @@ def default_registry(self) -> IntegrationRegistry[T]: @memoize(ttls=1800) def _cached_protocols(self) -> Dict[str, Dict[str, Any]]: """Cached result for integration implementations""" - protocols = {} + protocols = [] for name, api in self.registry: protocol = { "name": name, @@ -81,8 +81,9 @@ def _cached_protocols(self) -> Dict[str, Dict[str, Any]]: "child_settings" ] = api.child_settings_class().configuration_form(self._db) protocol.update(api.protocol_details(self._db)) - protocols[name] = protocol - return protocols + protocols.append((name, protocol)) + protocols.sort(key=lambda x: x[0]) + return dict(protocols) @property def protocols(self) -> Dict[str, Dict[str, Any]]: diff --git a/api/odl2.py b/api/odl2.py index d5654bab64..60a18c03b3 100644 --- a/api/odl2.py +++ b/api/odl2.py @@ -37,7 +37,7 @@ from core.model.patron import Hold, Loan, Patron -class ODL2Settings(OPDS2ImporterSettings, ODLSettings): +class ODL2Settings(ODLSettings, OPDS2ImporterSettings): skipped_license_formats: List[str] = FormField( default=["text/html"], alias="odl2_skipped_license_formats", diff --git a/core/opds_import.py b/core/opds_import.py index 68b4dd5dae..fb0d3d1fa9 100644 --- a/core/opds_import.py +++ b/core/opds_import.py @@ -134,10 +134,10 @@ class OPDSImporterSettings( "assume the books have this target audience." ), type=ConfigurationFormItemType.SELECT, - format="narrow", - options={_NO_DEFAULT_AUDIENCE: _("No default audience")}.update( - {audience: audience for audience in sorted(Classifier.AUDIENCES)} - ), + options={ + **{_NO_DEFAULT_AUDIENCE: _("No default audience")}, + **{audience: audience for audience in sorted(Classifier.AUDIENCES)}, + }, required=False, ), ) diff --git a/tests/api/admin/controller/test_patron_auth.py b/tests/api/admin/controller/test_patron_auth.py index b1925c04b4..ee375fb6e1 100644 --- a/tests/api/admin/controller/test_patron_auth.py +++ b/tests/api/admin/controller/test_patron_auth.py @@ -106,7 +106,6 @@ def test_patron_auth_services_get_with_no_services( protocols = response.get("protocols") assert isinstance(protocols, list) assert 7 == len(protocols) - assert SimpleAuthenticationProvider.__module__ == protocols[0].get("name") assert "settings" in protocols[0] assert "library_settings" in protocols[0]