Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
slack import: Log invalid token at info level instead of error.
Aman Agrawal672dcb48ad2e
diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.pyindex a9e77bbd05e..76f8b9d75f3 100644--- a/zerver/data_import/slack.py+++ b/zerver/data_import/slack.py@@ -1814,7 +1814,7 @@ def check_slack_token_access(token: str, required_scopes: set[str]) -> None:if not data.json()["ok"]:error = data.json()["error"]if error != "missing_scope":- logging.error("Slack token is invalid: %s", error)+ logging.info("Slack token is invalid: %s", error)raise ValueError(f"Invalid token: {token}")has_scopes = set(data.headers.get("x-oauth-scopes", "").split(","))missing_scopes = required_scopes - has_scopesdiff --git a/zerver/tests/test_slack_importer.py b/zerver/tests/test_slack_importer.pyindex 1af9c2fbbd0..53a7a8e4b9d 100644--- a/zerver/tests/test_slack_importer.py+++ b/zerver/tests/test_slack_importer.py@@ -445,7 +445,7 @@ class SlackImporter(ZulipTestCase):"Invalid token. Valid tokens start with xoxb-.",)- with self.assertLogs(level="ERROR"):+ with self.assertLogs(level="INFO"):self.assertEqual(exception_for("xoxb-invalid-token"),"Invalid token: xoxb-invalid-token",