]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/allmydata/test/test_client.py
rearrange encode/upload, add URIs, switch to ReplicatingEncoder
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / test / test_client.py
1
2 from twisted.trial import unittest
3
4 from allmydata import client
5
6 class Basic(unittest.TestCase):
7     def test_loadable(self):
8         c = client.Client("")
9         c.startService()
10         return c.stopService()
11
12     def test_permute(self):
13         c = client.Client("")
14         c.all_peers = ["%d" % i for i in range(5)]
15         self.failUnlessEqual(c.permute_peerids("one"), ['3','1','0','4','2'])
16         self.failUnlessEqual(c.permute_peerids("one", 3), ['3','1','0'])
17         self.failUnlessEqual(c.permute_peerids("two"), ['0','4','2','1','3'])
18         c.all_peers = []
19         self.failUnlessEqual(c.permute_peerids("one"), [])
20
21         c2 = client.Client("")
22         c2.all_peers = ["%d" % i for i in range(5)]
23         self.failUnlessEqual(c2.permute_peerids("one"), ['3','1','0','4','2'])
24