def test_no_player(self):
        # count minimum channels
        initial_num_channels = len(Test_shutdown.ts3.get_channellist())

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()

        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterinit_num_channels = len(clist)
        self.assertLess(initial_num_channels, afterinit_num_channels)

        superadmin.connects('superadmin')
        superadmin.says('!die')
        timeout = time.time() + 20
        while p.connected and time.time() < timeout:
            time.sleep(.5)
        if p.connected:
            self.fail("Could not disconnect from TeamSpeak server")

        time.sleep(.5)
        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterdeath_num_channels = len(clist)
        self.assertGreaterEqual(initial_num_channels, afterdeath_num_channels)
Ejemplo n.º 2
0
    def setUpClass(cls):
        global p, joe, conf

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()
        joe.connects('Joe')

        timeout = time.time() + 10
        while not p.tsconnection and time.time() < timeout:
            time.sleep(.1)
        if not p.tsconnection:
            raise AssertionError("Could not connect to TeamSpeak server")

        if not p.tsGetClient(joe):
            raise unittest.SkipTest(
                "please connect to the test Teamspeak server first and make sure your ip is %s as set in config.ini"
                % config.get("me", "ip"))

        channellist = p.tsSendCommand('channellist')
        cls.tsDefaultChannel = p.tsGetChannelIdByName(u'Default Channel',
                                                      channellist)
        if not cls.tsDefaultChannel:
            raise unittest.SkipTest("Could not get default teamspeak channel")
 def test_default_values(self):
     conf = XmlConfigParser()
     conf.setXml("""
     <configuration plugin="teamspeakbf">
     	<settings name="teamspeakServer">
             <set name="host">foo_host</set>
             <set name="queryport">foo_queryport</set>
             <set name="id">1</set>
             <set name="login">foo_login</set>
             <set name="password">foo_password</set>
         </settings>
     </configuration>
     """)
     p = TeamspeakPlugin(fakeConsole, conf)
     p.readConfig()
     self.assertEqual(TeamspeakPlugin.TS3ChannelB3, p.TS3ChannelB3)
     self.assertEqual(TeamspeakPlugin.TS3ChannelTeam1, p.TS3ChannelTeam1)
     self.assertEqual(TeamspeakPlugin.TS3ChannelTeam2, p.TS3ChannelTeam2)
 def test_default_values(self):
     conf = XmlConfigParser()
     conf.setXml("""
     <configuration plugin="teamspeakbf">
     	<settings name="teamspeakServer">
             <set name="host">foo_host</set>
             <set name="queryport">foo_queryport</set>
             <set name="id">1</set>
             <set name="login">foo_login</set>
             <set name="password">foo_password</set>
         </settings>
     </configuration>
     """)
     p = TeamspeakPlugin(fakeConsole, conf)
     p.readConfig()
     self.assertEqual(TeamspeakPlugin.TS3ChannelB3, p.TS3ChannelB3)
     self.assertEqual(TeamspeakPlugin.TS3ChannelTeam1, p.TS3ChannelTeam1)
     self.assertEqual(TeamspeakPlugin.TS3ChannelTeam2, p.TS3ChannelTeam2)
    def test_with_player(self):
        # count minimum channels
        initial_num_channels = len(Test_shutdown.ts3.get_channellist())

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()

        superadmin.connects('superadmin')

        if not p.tsGetClient(superadmin):
            raise unittest.SkipTest("please connect to the test Teamspeak server first and make sure your ip is %s as set in config.ini" % config.get("me", "ip"))


        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterinit_num_channels = len(clist)
        self.assertLess(initial_num_channels, afterinit_num_channels)

        superadmin.says('!ts join')
        time.sleep(.5)

        superadmin.says('!die')
        timeout = time.time() + 20
        while p.connected and time.time() < timeout:
            time.sleep(.5)
        if p.connected:
            self.fail("Could not disconnect from TeamSpeak server")

        time.sleep(.5)
        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterdeath_num_channels = len(clist)
        self.assertGreaterEqual(initial_num_channels, afterdeath_num_channels)
Ejemplo n.º 6
0
    def test_no_player(self):
        # count minimum channels
        initial_num_channels = len(Test_shutdown.ts3.get_channellist())

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()

        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterinit_num_channels = len(clist)
        self.assertLess(initial_num_channels, afterinit_num_channels)

        superadmin.connects('superadmin')
        superadmin.says('!die')
        timeout = time.time() + 20
        while p.connected and time.time() < timeout:
            time.sleep(.5)
        if p.connected:
            self.fail("Could not disconnect from TeamSpeak server")

        time.sleep(.5)
        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterdeath_num_channels = len(clist)
        self.assertGreaterEqual(initial_num_channels, afterdeath_num_channels)
 def test_nominal(self):
     conf = XmlConfigParser()
     conf.setXml("""
     <configuration plugin="teamspeakbf">
     	<settings name="teamspeakServer">
             <set name="host">foo_host</set>
             <set name="queryport">foo_queryport</set>
             <set name="id">1</set>
             <set name="login">foo_login</set>
             <set name="password">foo_password</set>
         </settings>
         <settings name="teamspeakChannels">
             <set name="B3">channel name</set>
             <set name="team1">Team 1 name</set>
             <set name="team2">Team 2 name</set>
             <set name="DefaultTarget">team</set>
         </settings>
     </configuration>
     """)
     p = TeamspeakPlugin(fakeConsole, conf)
     p.readConfig()
     self.assertEqual('channel name', p.TS3ChannelB3)
     self.assertEqual('Team 1 name', p.TS3ChannelTeam1)
     self.assertEqual('Team 2 name', p.TS3ChannelTeam2)
 def test_nominal(self):
     conf = XmlConfigParser()
     conf.setXml("""
     <configuration plugin="teamspeakbf">
     	<settings name="teamspeakServer">
             <set name="host">foo_host</set>
             <set name="queryport">foo_queryport</set>
             <set name="id">1</set>
             <set name="login">foo_login</set>
             <set name="password">foo_password</set>
         </settings>
         <settings name="teamspeakChannels">
             <set name="B3">channel name</set>
             <set name="team1">Team 1 name</set>
             <set name="team2">Team 2 name</set>
             <set name="DefaultTarget">team</set>
         </settings>
     </configuration>
     """)
     p = TeamspeakPlugin(fakeConsole, conf)
     p.readConfig()
     self.assertEqual('channel name', p.TS3ChannelB3)
     self.assertEqual('Team 1 name', p.TS3ChannelTeam1)
     self.assertEqual('Team 2 name', p.TS3ChannelTeam2)
    def setUpClass(cls):
        global p, joe, conf

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()
        joe.connects('Joe')

        timeout = time.time() + 10
        while not p.tsconnection and time.time() < timeout:
            time.sleep(.1)
        if not p.tsconnection:
            raise AssertionError("Could not connect to TeamSpeak server")

        if not p.tsGetClient(joe):
            raise unittest.SkipTest("please connect to the test Teamspeak server first and make sure your ip is %s as set in config.ini" % config.get("me", "ip"))

        channellist = p.tsSendCommand('channellist')
        cls.tsDefaultChannel= p.tsGetChannelIdByName(u'Default Channel', channellist)
        if not cls.tsDefaultChannel:
            raise unittest.SkipTest("Could not get default teamspeak channel")
Ejemplo n.º 10
0
    def test_with_player(self):
        # count minimum channels
        initial_num_channels = len(Test_shutdown.ts3.get_channellist())

        ## create an instance of the plugin to test
        p = TeamspeakPlugin(fakeConsole, conf)
        p.onLoadConfig()
        p.onStartup()

        superadmin.connects('superadmin')

        if not p.tsGetClient(superadmin):
            raise unittest.SkipTest(
                "please connect to the test Teamspeak server first and make sure your ip is %s as set in config.ini"
                % config.get("me", "ip"))

        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterinit_num_channels = len(clist)
        self.assertLess(initial_num_channels, afterinit_num_channels)

        superadmin.says('!ts join')
        time.sleep(.5)

        superadmin.says('!die')
        timeout = time.time() + 20
        while p.connected and time.time() < timeout:
            time.sleep(.5)
        if p.connected:
            self.fail("Could not disconnect from TeamSpeak server")

        time.sleep(.5)
        Test_shutdown.ts3.print_channel_tree()
        clist = Test_shutdown.ts3.get_channellist()
        afterdeath_num_channels = len(clist)
        self.assertGreaterEqual(initial_num_channels, afterdeath_num_channels)
Ejemplo n.º 11
0
		<set name="host">{ts_host}</set>
		<!-- query port of your teamspeak server (default: 10011) -->
		<set name="queryport">{ts_port}</set>
		<!-- Teamspeak virtual server ID -->
		<set name="id">{ts_id}</set>
		<!-- B3 login information. You need to create a ServerQuery Login for B3. video tutorial : http://bit.ly/a5qcjp -->
		<set name="login">{ts_login}</set>
		<set name="password">{ts_password}</set>
	</settings>
	<settings name="teamspeakChannels">
		<set name="B3">B3 autoswitched channel</set>
		<set name="team1">Team 1</set>
		<set name="team2">Team 2</set>
	</settings>
	<settings name="commands">
		<set name="tsreconnect">100</set>
		<set name="tsdisconnect">100</set>
        <set name="teamspeak-ts">0</set>
        <set name="tsauto-tsa">0</set>
	</settings>
</configuration>
""".format(ts_host=config.get("teamspeak_server", "host"),
           ts_port=config.get("teamspeak_server", "port"),
           ts_id=config.get("teamspeak_server", "id"),
           ts_login=config.get("teamspeak_server", "login"),
           ts_password=config.get("teamspeak_server", "password")))

p = TeamspeakPlugin(fakeConsole, conf)
p.onLoadConfig()
p.onStartup()
Ejemplo n.º 12
0
		<set name="team2">Team 2</set>
	</settings>
	<settings name="commands">
		<set name="tsreconnect">100</set>
		<set name="tsdisconnect">100</set>
        <set name="teamspeak-ts">0</set>
        <set name="tsauto-tsa">0</set>
	</settings>
</configuration>
""".format(ts_host=config.get("teamspeak_server", "host"),
           ts_port=config.get("teamspeak_server", "port"),
           ts_id=config.get("teamspeak_server", "id"),
           ts_login=config.get("teamspeak_server", "login"),
           ts_password=config.get("teamspeak_server", "password")))

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


def instruct(instructions):
    print "\n\n> %s" % instructions
    raw_input("type ENTER when ready")


me = FakeClient(fakeConsole,
                name="me",
                guid="zaerazerazerzaer",
                groupBits=128,
                team=TEAM_UNKNOWN,
                ip=config.get("me", "ip"))
		<set name="team2">Team 2</set>
	</settings>
	<settings name="commands">
		<set name="tsreconnect">100</set>
		<set name="tsdisconnect">100</set>
        <set name="teamspeak-ts">0</set>
        <set name="tsauto-tsa">0</set>
	</settings>
</configuration>
""".format(ts_host=config.get("teamspeak_server", "host"),
           ts_port=config.get("teamspeak_server", "port"),
           ts_id=config.get("teamspeak_server", "id"),
           ts_login=config.get("teamspeak_server", "login"),
           ts_password=config.get("teamspeak_server", "password")))

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

def instruct(instructions):
    print "\n\n> %s" % instructions
    raw_input("type ENTER when ready")


me = FakeClient(fakeConsole, name="me", guid="zaerazerazerzaer", groupBits=128, team=TEAM_UNKNOWN, ip=config.get("me", "ip"))

# force me to the managed channel
tsclient = p.tsGetClient(me)
while not tsclient:
    instruct("connect to the teamspeak server")
    tsclient = p.tsGetClient(me)