2006-12-14 03:32:35 +00:00
|
|
|
#! /usr/bin/python
|
|
|
|
|
|
|
|
from twisted.trial import unittest
|
|
|
|
from twisted.internet import defer
|
|
|
|
from allmydata import encode_new
|
|
|
|
from cStringIO import StringIO
|
|
|
|
|
|
|
|
class MyEncoder(encode_new.Encoder):
|
|
|
|
def send(self, share_num, methname, *args, **kwargs):
|
2006-12-14 11:31:17 +00:00
|
|
|
if False and share_num < 10:
|
|
|
|
print "send[%d].%s()" % (share_num, methname)
|
|
|
|
if methname == "put_share_hashes":
|
|
|
|
print " ", [i for i,h in args[0]]
|
2006-12-14 03:32:35 +00:00
|
|
|
return defer.succeed(None)
|
|
|
|
|
|
|
|
class Encode(unittest.TestCase):
|
2006-12-14 11:17:01 +00:00
|
|
|
def test_1(self):
|
2006-12-14 03:32:35 +00:00
|
|
|
e = MyEncoder()
|
|
|
|
data = StringIO("some data to encode\n")
|
|
|
|
e.setup(data)
|
|
|
|
d = e.start()
|
|
|
|
return d
|
|
|
|
|