xkcd tests: Use consistent imports.
This commit is contained in:
parent
5d211b0c84
commit
031510410b
|
@ -1,4 +1,3 @@
|
||||||
from unittest import mock
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ class TestXkcdBot(BotTestCase, DefaultTests):
|
||||||
with self.mock_http_conversation('test_random'):
|
with self.mock_http_conversation('test_random'):
|
||||||
# Mock randint function.
|
# Mock randint function.
|
||||||
with patch('zulip_bots.bots.xkcd.xkcd.random.randint') as randint:
|
with patch('zulip_bots.bots.xkcd.xkcd.random.randint') as randint:
|
||||||
mock_rand_value = mock.MagicMock()
|
mock_rand_value = MagicMock()
|
||||||
mock_rand_value.return_value = 1800
|
mock_rand_value.return_value = 1800
|
||||||
randint.return_value = mock_rand_value.return_value
|
randint.return_value = mock_rand_value.return_value
|
||||||
self.verify_reply('random', bot_response)
|
self.verify_reply('random', bot_response)
|
||||||
|
@ -31,8 +30,8 @@ class TestXkcdBot(BotTestCase, DefaultTests):
|
||||||
with self.mock_http_conversation('test_specific_id'):
|
with self.mock_http_conversation('test_specific_id'):
|
||||||
self.verify_reply('1', bot_response)
|
self.verify_reply('1', bot_response)
|
||||||
|
|
||||||
@mock.patch('logging.exception')
|
@patch('logging.exception')
|
||||||
def test_invalid_comic_ids(self, mock_logging_exception: mock.Mock) -> None:
|
def test_invalid_comic_ids(self, mock_logging_exception: MagicMock) -> None:
|
||||||
invalid_id_txt = "Sorry, there is likely no xkcd comic strip with id: #"
|
invalid_id_txt = "Sorry, there is likely no xkcd comic strip with id: #"
|
||||||
|
|
||||||
for comic_id, fixture in (('0', 'test_not_existing_id_2'),
|
for comic_id, fixture in (('0', 'test_not_existing_id_2'),
|
||||||
|
|
Loading…
Reference in a new issue