Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d5374f
commit 4be1285
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
:Copyright: 2007-2021 Jochen Kupperschmidt | ||
:License: MIT, see LICENSE for details. | ||
""" | ||
|
||
from weitersager.config import Config, HttpConfig, IrcConfig | ||
from weitersager.processor import Processor | ||
from weitersager.signals import irc_channel_joined | ||
|
||
|
||
def test_channel_enabling_on_join_signal(): | ||
processor = create_processor() | ||
|
||
assert '#example1' not in processor.enabled_channel_names | ||
assert '#example2' not in processor.enabled_channel_names | ||
|
||
irc_channel_joined.send(channel_name='#example1') | ||
|
||
assert '#example1' in processor.enabled_channel_names | ||
assert '#example2' not in processor.enabled_channel_names | ||
|
||
irc_channel_joined.send(channel_name='#example2') | ||
|
||
assert '#example1' in processor.enabled_channel_names | ||
assert '#example2' in processor.enabled_channel_names | ||
|
||
|
||
def create_processor(): | ||
http_config = HttpConfig( | ||
host='127.0.0.1', | ||
port='8080', | ||
api_tokens=set(), | ||
) | ||
|
||
irc_config = IrcConfig( | ||
server=None, | ||
nickname='nick', | ||
realname='Nick', | ||
channels=set(), | ||
) | ||
|
||
config = Config(log_level=None, http=http_config, irc=irc_config) | ||
|
||
return Processor(config) |