2006-11-30 16:23:01 -07:00
|
|
|
|
|
|
|
from twisted.trial import unittest
|
|
|
|
|
|
|
|
from allmydata import client
|
|
|
|
|
|
|
|
class Basic(unittest.TestCase):
|
2006-11-30 20:18:51 -07:00
|
|
|
def test_loadable(self):
|
2006-11-30 17:13:40 -07:00
|
|
|
c = client.Client("")
|
2006-11-30 16:23:01 -07:00
|
|
|
c.startService()
|
|
|
|
return c.stopService()
|
|
|
|
|
2006-11-30 20:18:51 -07:00
|
|
|
def test_permute(self):
|
|
|
|
c = client.Client("")
|
|
|
|
c.all_peers = ["%d" % i for i in range(5)]
|
|
|
|
self.failUnlessEqual(c.permute_peerids("one"), ['3','1','0','4','2'])
|
|
|
|
self.failUnlessEqual(c.permute_peerids("one", 3), ['3','1','0'])
|
|
|
|
self.failUnlessEqual(c.permute_peerids("two"), ['0','4','2','1','3'])
|
|
|
|
c.all_peers = []
|
|
|
|
self.failUnlessEqual(c.permute_peerids("one"), [])
|