diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2021-03-20 13:41:02 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2021-03-20 13:42:40 +0100 |
commit | 373baece5094b5bedf10e08ea95d09be3619fd23 (patch) | |
tree | de7b6c84c3512c7a08aecf05c351936389bcdebf /_pytest/test_topic_command.py | |
parent | bf9ef6f4bcd580a9b4ba858537d0a99cae7bb87e (diff) | |
download | wee-slack-373baece5094b5bedf10e08ea95d09be3619fd23.tar.gz |
Format all python files with black
Diffstat (limited to '_pytest/test_topic_command.py')
-rw-r--r-- | _pytest/test_topic_command.py | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/_pytest/test_topic_command.py b/_pytest/test_topic_command.py index 79a26d3..1b1c15d 100644 --- a/_pytest/test_topic_command.py +++ b/_pytest/test_topic_command.py @@ -6,66 +6,67 @@ from mock import patch def test_parse_topic_without_arguments(): - channel_name, topic = parse_topic_command('/topic') + channel_name, topic = parse_topic_command("/topic") assert channel_name is None assert topic is None def test_parse_topic_with_text(): - channel_name, topic = parse_topic_command('/topic some topic text') + channel_name, topic = parse_topic_command("/topic some topic text") assert channel_name is None - assert topic == 'some topic text' + assert topic == "some topic text" def test_parse_topic_with_text_with_newline(): - channel_name, topic = parse_topic_command('/topic some topic text\nsecond line') + channel_name, topic = parse_topic_command("/topic some topic text\nsecond line") assert channel_name is None - assert topic == 'some topic text\nsecond line' + assert topic == "some topic text\nsecond line" def test_parse_topic_with_delete(): - channel_name, topic = parse_topic_command('/topic -delete') + channel_name, topic = parse_topic_command("/topic -delete") assert channel_name is None - assert topic == '' + assert topic == "" def test_parse_topic_with_channel(): - channel_name, topic = parse_topic_command('/topic #general') + channel_name, topic = parse_topic_command("/topic #general") - assert channel_name == '#general' + assert channel_name == "#general" assert topic is None def test_parse_topic_with_channel_and_text(): - channel_name, topic = parse_topic_command( - '/topic #general some topic text') + channel_name, topic = parse_topic_command("/topic #general some topic text") - assert channel_name == '#general' - assert topic == 'some topic text' + assert channel_name == "#general" + assert topic == "some topic text" def test_parse_topic_with_channel_and_delete(): - channel_name, topic = parse_topic_command('/topic #general -delete') + channel_name, topic = parse_topic_command("/topic #general -delete") - assert channel_name == '#general' - assert topic == '' + assert channel_name == "#general" + assert topic == "" def test_call_topic_without_arguments(realish_eventrouter, channel_general): current_buffer = channel_general.channel_buffer wee_slack.EVENTROUTER = realish_eventrouter - command = '/topic' + command = "/topic" - with patch('wee_slack.w.prnt') as fake_prnt: + with patch("wee_slack.w.prnt") as fake_prnt: result = topic_command_cb(None, current_buffer, command) fake_prnt.assert_called_with( channel_general.channel_buffer, - 'Topic for {} is "{}"'.format(channel_general.name, channel_general.topic['value']), + 'Topic for {} is "{}"'.format( + channel_general.name, channel_general.topic["value"] + ), ) assert result == wee_slack.w.WEECHAT_RC_OK_EAT @@ -74,9 +75,9 @@ def test_call_topic_with_unknown_channel(realish_eventrouter, team, channel_gene current_buffer = channel_general.channel_buffer wee_slack.EVENTROUTER = realish_eventrouter - command = '/topic #nonexisting' + command = "/topic #nonexisting" - with patch('wee_slack.w.prnt') as fake_prnt: + with patch("wee_slack.w.prnt") as fake_prnt: result = topic_command_cb(None, current_buffer, command) fake_prnt.assert_called_with( team.channel_buffer, @@ -89,11 +90,14 @@ def test_call_topic_with_channel_and_string(realish_eventrouter, channel_general current_buffer = channel_general.channel_buffer wee_slack.EVENTROUTER = realish_eventrouter - command = '/topic #general new topic' + command = "/topic #general new topic" result = topic_command_cb(None, current_buffer, command) request = realish_eventrouter.queue[-1] - assert request.request == 'conversations.setTopic' + assert request.request == "conversations.setTopic" assert request.post_data == { - 'channel': 'C407ABS94', 'token': 'xoxs-token', 'topic': 'new topic'} + "channel": "C407ABS94", + "token": "xoxs-token", + "topic": "new topic", + } assert result == wee_slack.w.WEECHAT_RC_OK_EAT |