summaryrefslogtreecommitdiff
path: root/crocoite/test_irc.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-03-08 10:05:12 +0100
committerLars-Dominik Braun <lars@6xq.net>2019-03-08 10:05:12 +0100
commit36876a5d608ccfc3d594fa6906f04b4feca08142 (patch)
treedc9341e337e02d5b1745137d20cb0a317a38f1d8 /crocoite/test_irc.py
parent719a1c7b0dc885ca02aca702ba2bb49ef3878066 (diff)
downloadcrocoite-36876a5d608ccfc3d594fa6906f04b4feca08142.tar.gz
crocoite-36876a5d608ccfc3d594fa6906f04b4feca08142.tar.bz2
crocoite-36876a5d608ccfc3d594fa6906f04b4feca08142.zip
irc: Add config option need_voice
Do not hardcode required priviledge to use bot, make it configureable.
Diffstat (limited to 'crocoite/test_irc.py')
-rw-r--r--crocoite/test_irc.py19
1 files changed, 18 insertions, 1 deletions
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)
+