def test_1337_port(self):
        conf = XmlConfigParser()
        conf.loadFromString("""
            <configuration plugin="haxbusterurt">
                <settings name="settings">
                    <set name="allow_empty_guid">yes</set>
                    <set name="1337_port_penalty">kick</set>
                </settings>
            </configuration>
        """)
        p = HaxbusterurtPlugin(self.console, conf)
        p.onStartup()
        p.onLoadConfig()

        self.joe.port = "1337"
        self.joe.kick = Mock(wraps=self.joe.kick)
        self.joe.connects(cid='1')
        self.assertEqual(1, self.joe.kick.call_count)

        self.moderator.port = "12454"
        self.moderator.kick = Mock(wraps=self.moderator.kick)
        self.moderator.connects(cid='3')
        self.assertFalse(self.moderator.kick.called)
    def test_bad_guid(self):
        conf = XmlConfigParser()
        conf.loadFromString("""
            <configuration plugin="haxbusterurt">
                <settings name="settings">
                    <set name="allow_empty_guid">yes</set>
                    <set name="bad_guid_penalty">tempban</set>
                </settings>
            </configuration>
        """)
        p = HaxbusterurtPlugin(self.console, conf)
        p.onStartup()
        p.onLoadConfig()

        self.joe._guid="bad_guid"
        self.joe.tempban = Mock(wraps=self.joe.tempban)
        self.joe.connects(cid='1')
        self.assertEqual(1, self.joe.tempban.call_count)

        self.moderator._guid = "123456789012345678901234567890AB"
        self.moderator.tempban = Mock(wraps=self.moderator.tempban)
        self.moderator.connects(cid='3')
        self.assertFalse(self.moderator.tempban.called)
# -*- encoding: utf-8 -*-
from test import prepare_fakeparser_for_tests, set_clients_ports
prepare_fakeparser_for_tests()

from b3.fake import fakeConsole, FakeClient, superadmin
from haxbusterurt import HaxbusterurtPlugin
from b3.config import XmlConfigParser


conf = XmlConfigParser()
conf.loadFromString("""
<configuration plugin="haxbusterurt">
	<settings name="settings">
	</settings>
</configuration>
""")

p = HaxbusterurtPlugin(fakeConsole, conf)
p.onLoadConfig()
p.onStartup()


set_clients_ports({'0': '321', '1': '654'})

maxime = FakeClient(fakeConsole, name="BOT4", exactName="BOT4", ip="0.0.0.0", guid="BOT4")
maxime.connects('1')