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)
Exemple #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 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")
Exemple #4
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)
Exemple #5
0

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)

me.connects(0)

if not p.tsIsClientInB3Channel(tsclient):
    p.tsMoveTsclientToChannelId(tsclient, p.tsChannelIdB3)

time.sleep(.5)
me.says('!ts')

time.sleep(.5)
me.says('!ts disjoin')
           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)

me.connects(0)

if not p.tsIsClientInB3Channel(tsclient):
    p.tsMoveTsclientToChannelId(tsclient, p.tsChannelIdB3)

time.sleep(.5)
me.says('!ts')

time.sleep(.5)
me.says('!ts disjoin')