From 36876a5d608ccfc3d594fa6906f04b4feca08142 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 8 Mar 2019 10:05:12 +0100 Subject: irc: Add config option need_voice Do not hardcode required priviledge to use bot, make it configureable. --- crocoite/test_irc.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'crocoite/test_irc.py') diff --git a/crocoite/test_irc.py b/crocoite/test_irc.py index 4d80a6d..9344de4 100644 --- a/crocoite/test_irc.py +++ b/crocoite/test_irc.py @@ -19,7 +19,7 @@ # THE SOFTWARE. import pytest -from .irc import ArgparseBot, RefCountEvent +from .irc import ArgparseBot, RefCountEvent, User, NickMode def test_mode_parse (): assert ArgparseBot.parseMode ('+a') == [('+', 'a')] @@ -51,3 +51,20 @@ def test_refcountevent_arm_with (event): event.arm () assert not event.event.is_set () assert event.event.is_set () + +def test_nick_mode (): + a = User.fromName ('a') + a2 = User.fromName ('a') + a3 = User.fromName ('+a') + b = User.fromName ('+b') + c = User.fromName ('@c') + + # equality is based on name only, not mode + assert a == a2 + assert a == a3 + assert a != b + + assert a.hasPriv (None) and not a.hasPriv (NickMode.voice) and not a.hasPriv (NickMode.operator) + assert b.hasPriv (None) and b.hasPriv (NickMode.voice) and not b.hasPriv (NickMode.operator) + assert c.hasPriv (None) and c.hasPriv (NickMode.voice) and c.hasPriv (NickMode.operator) + -- cgit v1.2.3