Line | |
---|
1 | """ |
---|
2 | Ported to Python 3. |
---|
3 | """ |
---|
4 | |
---|
5 | from ..common import AsyncTestCase |
---|
6 | from .util import FakeStorage, make_nodemaker |
---|
7 | |
---|
8 | class DifferentEncoding(AsyncTestCase): |
---|
9 | def setUp(self): |
---|
10 | super(DifferentEncoding, self).setUp() |
---|
11 | self._storage = s = FakeStorage() |
---|
12 | self.nodemaker = make_nodemaker(s) |
---|
13 | |
---|
14 | def test_filenode(self): |
---|
15 | # create a file with 3-of-20, then modify it with a client configured |
---|
16 | # to do 3-of-10. #1510 tracks a failure here |
---|
17 | self.nodemaker.default_encoding_parameters["n"] = 20 |
---|
18 | d = self.nodemaker.create_mutable_file(b"old contents") |
---|
19 | def _created(n): |
---|
20 | filecap = n.get_cap().to_string() |
---|
21 | del n # we want a new object, not the cached one |
---|
22 | self.nodemaker.default_encoding_parameters["n"] = 10 |
---|
23 | n2 = self.nodemaker.create_from_cap(filecap) |
---|
24 | return n2 |
---|
25 | d.addCallback(_created) |
---|
26 | def modifier(old_contents, servermap, first_time): |
---|
27 | return b"new contents" |
---|
28 | d.addCallback(lambda n: n.modify(modifier)) |
---|
29 | return d |
---|
Note: See
TracBrowser
for help on using the repository browser.