blob: 2a4f0690ca031543ffd90aa6faff68387b985ff3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
from wee_slack import parse_topic_command
def test_parse_topic_without_arguments():
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')
assert channel_name is None
assert topic == 'some topic text'
def test_parse_topic_with_delete():
channel_name, topic = parse_topic_command('/topic -delete')
assert channel_name is None
assert topic == ''
def test_parse_topic_with_channel():
channel_name, topic = parse_topic_command('/topic #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')
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')
assert channel_name == 'general'
assert topic == ''
|