Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
duckhunt: Add tests for ignore integration
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed Oct 18, 2019
1 parent 217e874 commit 8cb9561
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/plugin_tests/test_duckhunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,41 @@ class Conn:
assert duckhunt.killers('#channel', event, chan, conn, session) is None

event.notice_doc.assert_called_once()


def test_ignore_integration():
from plugins import duckhunt
event = MagicMock()
event.chan = "#chan"
event.mask = "nick!user@host"
event.host = "host"

ignore_plugin = MagicMock()

ignore_plugin.code.is_ignored.return_value = True

plugins = {
'core.ignore': ignore_plugin,
}

def find_plugin(name):
return plugins.get(name)

event.bot.plugin_manager.find_plugin = find_plugin

conn = event.conn
conn.name = "testconn"

tbl = duckhunt.get_state_table(conn.name, event.chan)
tbl.game_on = True
tbl.duck_status = 0

duckhunt.increment_msg_counter(event, conn)

assert not tbl.masks

ignore_plugin.code.is_ignored.return_value = False

duckhunt.increment_msg_counter(event, conn)

assert tbl.masks == [event.host]

0 comments on commit 8cb9561

Please sign in to comment.