Exemple #1
0
    def test_get_config(self):
        # Invalid URL.
        try:
            bt.getConfig(url="test")
        except ValueError:
            pass

        # Valid XML.
        configxml = """<?xml version="1.0" encoding="UTF-8"?>
<settings>
<client ip="127.0.0.1" lat="40" lon="-90" isp="Comcast Cable" isprating="2.9" rating="0" ispdlavg="30000" ispulavg="60000" loggedin="0" />
<times dl1="5000000" dl2="35000000" dl3="800000000" ul1="1000000" ul2="8000000" ul3="35000000" />
<download testlength="10" initialtest="250K" mintestsize="250K" threadsperurl="4" />
<upload testlength="10" ratio="5" initialtest="0" mintestsize="32K" threads="2" maxchunksize="512K" maxchunkcount="50" threadsperurl="4" />
</settings>
        """
        self.assertTrue(type(bt.getConfig(configxml=configxml)) is dict)
    def test_get_config(self):
        # Invalid URL.
        try:
            bt.getConfig(url="test")
        except ValueError:
            pass
            
        # Valid XML.
        configxml = """<?xml version="1.0" encoding="UTF-8"?>
<settings>
<client ip="127.0.0.1" lat="40" lon="-90" isp="Comcast Cable" isprating="2.9" rating="0" ispdlavg="30000" ispulavg="60000" loggedin="0" />
<times dl1="5000000" dl2="35000000" dl3="800000000" ul1="1000000" ul2="8000000" ul3="35000000" />
<download testlength="10" initialtest="250K" mintestsize="250K" threadsperurl="4" />
<upload testlength="10" ratio="5" initialtest="0" mintestsize="32K" threads="2" maxchunksize="512K" maxchunkcount="50" threadsperurl="4" />
</settings>
        """
        self.assertTrue(type(bt.getConfig(configxml=configxml)) is dict)
 def test_closest_servers(self):
     configxml = bt.getConfig()
     servers = bt.closestServers(configxml["client"])
     self.assertTrue(len(servers))
     self.assertTrue(type(bt.getBestServer(servers)) is dict)
Exemple #4
0
 def test_closest_servers(self):
     configxml = bt.getConfig()
     servers = bt.closestServers(configxml["client"])
     self.assertTrue(len(servers))
     self.assertTrue(type(bt.getBestServer(servers)) is dict)