From 0ef7e397b5dfa1cbd89b02b1b9e66aa5ad96d7b3 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 26 Jul 2023 12:03:56 +0200
Subject: [PATCH] scrubber.cli: Fix raised exception typo

This was found while deploying the new version.
---
 swh/scrubber/cli.py            | 4 ++--
 swh/scrubber/tests/test_cli.py | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/swh/scrubber/cli.py b/swh/scrubber/cli.py
index f6efe69..8aa55fc 100644
--- a/swh/scrubber/cli.py
+++ b/swh/scrubber/cli.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022  The Software Heritage developers
+# Copyright (C) 2022-2023  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
@@ -315,7 +315,7 @@ def scrubber_check_storage(
         config_id = db.config_get_by_name(name)
 
     if config_id is None:
-        raise click.ClickExceptino("A valid configuration name/id must be set")
+        raise click.ClickException("A valid configuration name/id must be set")
     checker = StorageChecker(
         db=ctx.obj["db"],
         storage=get_storage(**conf["storage"]),
diff --git a/swh/scrubber/tests/test_cli.py b/swh/scrubber/tests/test_cli.py
index 74bc90b..b8b21b7 100644
--- a/swh/scrubber/tests/test_cli.py
+++ b/swh/scrubber/tests/test_cli.py
@@ -199,6 +199,13 @@ def test_check_storage(mocker, scrubber_db, swh_storage):
     assert result.output == ""
 
 
+def test_check_storage_ko(mocker, scrubber_db, swh_storage):
+    # using the config id instead of the config name
+    result = invoke(scrubber_db, ["check", "storage"], storage=swh_storage)
+    assert result.exit_code == 1, result.output
+    assert result.output == "Error: A valid configuration name/id must be set\n"
+
+
 def test_check_list(mocker, scrubber_db, swh_storage):
     mocker.patch("swh.scrubber.get_scrubber_db", return_value=scrubber_db)
     result = invoke(scrubber_db, ["check", "list"], storage=swh_storage)
-- 
GitLab