source: trunk/src/allmydata/test/mutable/test_different_encoding.py

Last change on this file was 1cfe843d, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-22T23:40:25Z

more python2 removal

  • Property mode set to 100644
File size: 1.0 KB
Line 
1"""
2Ported to Python 3.
3"""
4
5from ..common import AsyncTestCase
6from .util import FakeStorage, make_nodemaker
7
8class 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.