Passed
Push — main ( 392e9b...3378a3 )
by Jochen
04:26
created

tests.test_dummy_announcer.config()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nop 0
dl 0
loc 10
rs 9.95
c 0
b 0
f 0
1
"""
2
:Copyright: 2007-2021 Jochen Kupperschmidt
3
:License: MIT, see LICENSE for details.
4
"""
5
6
import pytest
7
8
from weitersager.irc import create_announcer, IrcChannel, IrcConfig
9
from weitersager.signals import irc_channel_joined
10
11
12
@pytest.fixture
13
def config():
14
    channels = {IrcChannel('#one'), IrcChannel('#two')}
15
16
    return IrcConfig(
17
        server=None,
18
        nickname='nick',
19
        realname='Nick',
20
        commands=[],
21
        channels=channels,
22
    )
23
24
25
@pytest.fixture
26
def announcer(config):
27
    announcer = create_announcer(config)
28
29
    yield announcer
30
31
    announcer.shutdown()
32
33
34
def test_fake_channel_joins(announcer):
35
    received_signal_data = []
36
37
    @irc_channel_joined.connect
38
    def handle_irc_channel_joined(sender, **data):
39
        received_signal_data.append(data)
40
41
    announcer.start()
42
43
    assert received_signal_data == [
44
        {'channel_name': '#one'},
45
        {'channel_name': '#two'},
46
    ]
47