Skip to content

Commit

Permalink
Fix imports in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mfitz committed Oct 23, 2023
1 parent 5be3400 commit dbfdcea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pytest
import requests
import slack
from slack.errors import SlackApiError
import slack_sdk
from slack_sdk.errors import SlackApiError

import main

Expand All @@ -30,7 +30,7 @@ def a_good_reddit_image_post():

def test_propagates_slack_client_errors(mocker):
slack_error = SlackApiError("OOPSY DAISY!", 'some-response')
mocker.patch.object(slack.WebClient, 'chat_postMessage', side_effect=slack_error)
mocker.patch.object(slack_sdk.WebClient, 'chat_postMessage', side_effect=slack_error)

with pytest.raises(SlackApiError) as raised_error:
main.send_slack_message('some-channel', 'some-token', [])
Expand All @@ -40,7 +40,7 @@ def test_propagates_slack_client_errors(mocker):

def test_prints_slack_api_response_when_sending_slack_messages(mocker):
response = {"Stuff": "Some response stuff"}
mocker.patch.object(slack.WebClient, 'chat_postMessage', return_value=response)
mocker.patch.object(slack_sdk.WebClient, 'chat_postMessage', return_value=response)
mocker.patch.object(main, 'print')

main.send_slack_message('some-channel', 'some-token', [])
Expand Down

0 comments on commit dbfdcea

Please sign in to comment.