Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
maxneuvians authored Jan 26, 2024
1 parent 5438cf0 commit ffc67d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions app/commands/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def secret_command(client, ack, command, body):
client.views_open(trigger_id=body["trigger_id"], view=view)


def secret_view_handler(ack, client, view):
def secret_view_handler(ack, client, view, logger):
ack()
locale = view["blocks"][0]["elements"][0]["value"]
i18n.set("locale", locale)
Expand All @@ -43,7 +43,8 @@ def secret_view_handler(ack, client, view):
user=view["private_metadata"],
text=f"{i18n.t('secret.link_available')} {url}",
)
except:
except Exception as e:
logger.error(e)
client.chat_postEphemeral(
channel=view["private_metadata"],
user=view["private_metadata"],
Expand Down
10 changes: 5 additions & 5 deletions app/tests/commands/test_secret.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import datetime

from commands import secret

from unittest.mock import call, MagicMock, patch
from unittest.mock import MagicMock, patch


@patch("commands.secret.generate_secret_command_modal_view")
Expand Down Expand Up @@ -38,6 +36,7 @@ def test_secret_command(mock_get_user_locale, mock_generate_secret_command_modal
def test_secret_view_handler_with_succesfull_request(mock_time, mock_requests):
ack = MagicMock()
client = MagicMock()
logger = MagicMock()
view = {
"blocks": [
{
Expand Down Expand Up @@ -71,7 +70,7 @@ def test_secret_view_handler_with_succesfull_request(mock_time, mock_requests):

mock_requests.post.return_value.json.return_value = {"id": "id"}

secret.secret_view_handler(ack, client, view)
secret.secret_view_handler(ack, client, view, logger)

ack.assert_called_once_with()

Expand All @@ -94,6 +93,7 @@ def test_secret_view_handler_with_succesfull_request(mock_time, mock_requests):
def test_secret_view_handler_with_failed_request(mock_time, mock_requests):
ack = MagicMock()
client = MagicMock()
logger = MagicMock()
view = {
"blocks": [
{
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_secret_view_handler_with_failed_request(mock_time, mock_requests):

mock_requests.post.return_value.json.return_value = {}

secret.secret_view_handler(ack, client, view)
secret.secret_view_handler(ack, client, view, logger)

ack.assert_called_once_with()

Expand Down

0 comments on commit ffc67d7

Please sign in to comment.