From: david-sarah Date: Thu, 10 Jun 2010 18:26:47 +0000 (-0700) Subject: SFTP: add test for extension of file opened with FXF_APPEND. X-Git-Url: https://git.rkrishnan.org/nxhtml.html?a=commitdiff_plain;h=546c3d2ed471daacb1c253fdac52e2c28c673766;p=tahoe-lafs%2Ftahoe-lafs.git SFTP: add test for extension of file opened with FXF_APPEND. --- 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,