Skip to content

Commit

Permalink
Improvements suggested by davisagli
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed May 16, 2023
1 parent 584600d commit 0cbd045
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/plone/api/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"AddonInformation",
"NonInstallableAddons",
"get_addons",
"get_addons_ids",
"get_addon_ids",
"get_version",
"get",
"install",
Expand Down Expand Up @@ -217,11 +217,11 @@ def get_addons(limit: str = "") -> List[AddonInformation]:
if limit in ("installed", "upgradable", "available"):
addons = [addon for addon in addons if limit in addon.flags]
elif limit != "":
raise InvalidParameterError(f"Value {limit} for parameter mode is not valid.")
raise InvalidParameterError(f"Parameter {limit=} is not valid.")
return addons


def get_addons_ids(limit: str = "") -> List[str]:
def get_addon_ids(limit: str = "") -> List[str]:
"""List addons ids in this Plone site.
:param limit: Limit list of addons.
Expand Down
8 changes: 4 additions & 4 deletions src/plone/api/tests/test_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def test_api_get_addons_limit_invalid(self):
with self.assertRaises(api.exc.InvalidParameterError) as cm:
api.addon.get_addons(limit="foobar")
self.assertIn(
"Value foobar for parameter mode is not valid.", str(cm.exception)
"Parameter limit='foobar' is not valid.", str(cm.exception)
)

def test_api_get_addons_ids(self):
"""Test api.addon.get_addons_ids."""
result = api.addon.get_addons_ids(limit="installed")
def test_api_get_addon_ids(self):
"""Test api.addon.get_addon_ids."""
result = api.addon.get_addon_ids(limit="installed")
self.assertEqual(len(result), 2)
self.assertIn(ADDON, result)

Expand Down

0 comments on commit 0cbd045

Please sign in to comment.