From 546c3d2ed471daacb1c253fdac52e2c28c673766 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Thu, 10 Jun 2010 11:26:47 -0700 Subject: [PATCH] SFTP: add test for extension of file opened with FXF_APPEND. --- src/allmydata/test/test_sftp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_sftp.py b/src/allmydata/test/test_sftp.py index 66c8abbb..55f76019 100644 --- a/src/allmydata/test/test_sftp.py +++ b/src/allmydata/test/test_sftp.py @@ -669,12 +669,18 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas def _write_append(wf): d2 = wf.writeChunk(0, "0123456789") d2.addCallback(lambda ign: wf.writeChunk(8, "0123")) + + d2.addCallback(lambda ign: wf.setAttrs({'size': 17})) + d2.addCallback(lambda ign: wf.getAttrs()) + d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['size'], 17)) + + d2.addCallback(lambda ign: wf.writeChunk(0, "z")) d2.addCallback(lambda ign: wf.close()) return d2 d.addCallback(_write_append) d.addCallback(lambda ign: self.root.get(u"newfile")) d.addCallback(lambda node: download_to_data(node)) - d.addCallback(lambda data: self.failUnlessReallyEqual(data, "01234567890123")) + d.addCallback(lambda data: self.failUnlessReallyEqual(data, "01234567890123\x00\x00\x00z")) # test WRITE | TRUNC without CREAT, when the file already exists # This is invalid according to section 6.3 of the SFTP spec, but required for interoperability, -- 2.45.2