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_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)
Example #3
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)
Example #4
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 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")
Example #6
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)
Example #7
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()