Total Complexity | 2 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ |
||
2 | :Copyright: 2007-2021 Jochen Kupperschmidt |
||
3 | :License: MIT, see LICENSE for details. |
||
4 | """ |
||
5 | |||
6 | from weitersager.config import Config, HttpConfig, IrcConfig |
||
7 | from weitersager.processor import Processor |
||
8 | from weitersager.signals import irc_channel_joined |
||
9 | |||
10 | |||
11 | def test_channel_enabling_on_join_signal(): |
||
12 | processor = create_processor() |
||
13 | |||
14 | assert '#example1' not in processor.enabled_channel_names |
||
15 | assert '#example2' not in processor.enabled_channel_names |
||
16 | |||
17 | irc_channel_joined.send(channel_name='#example1') |
||
18 | |||
19 | assert '#example1' in processor.enabled_channel_names |
||
20 | assert '#example2' not in processor.enabled_channel_names |
||
21 | |||
22 | irc_channel_joined.send(channel_name='#example2') |
||
23 | |||
24 | assert '#example1' in processor.enabled_channel_names |
||
25 | assert '#example2' in processor.enabled_channel_names |
||
26 | |||
27 | |||
28 | def create_processor(): |
||
29 | http_config = HttpConfig( |
||
30 | host='127.0.0.1', |
||
31 | port='8080', |
||
32 | api_tokens=set(), |
||
33 | ) |
||
34 | |||
35 | irc_config = IrcConfig( |
||
36 | server=None, |
||
37 | nickname='nick', |
||
38 | realname='Nick', |
||
39 | channels=set(), |
||
40 | ) |
||
41 | |||
42 | config = Config(log_level=None, http=http_config, irc=irc_config) |
||
43 | |||
44 | return Processor(config) |
||
45 |