Skip to content

Commit

Permalink
release: throw in case of trying to get a release with an empty strin…
Browse files Browse the repository at this point in the history
…g uuid

Change-type: patch
  • Loading branch information
otaviojacobi committed Oct 15, 2024
1 parent 7f1cf70 commit c8df914
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions balena/models/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def get(
if commit_or_id_or_raw_version is None:
raise exceptions.ReleaseNotFound(commit_or_id_or_raw_version)

if len(commit_or_id_or_raw_version) == 0:
raise exceptions.InvalidParameter("UUID can not be empty")

if is_id(commit_or_id_or_raw_version):
release = self.__pine.get(
{"resource": "release", "id": commit_or_id_or_raw_version, "options": options} # type: ignore
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/models/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def test_06_get_release_by_resources(self):
) # type: ignore
self.__expect_release_to_match_on_get(release, match)

with self.assertRaises(self.helper.balena_exceptions.InvalidParameter):
self.balena.models.release.get("")

def test_07_get_all_by_application(self):
app_id = self.mc_app["app"]["id"]
releases = self.balena.models.release.get_all_by_application(app_id)
Expand Down

0 comments on commit c8df914

Please sign in to comment.