def testCreateFile(self): s = Store(self.mktemp()) f = s.newFile('test', 'whatever.txt') f.write('crap') def cb(fpath): self.assertEquals(fpath.open().read(), 'crap') return f.close().addCallback(cb)
def testRelocatingPaths(self): spath = self.mktemp() npath = self.mktemp() s = Store(spath) rel = s.newFile("test", "123") TEST_STR = "test 123" def cb(fpath): fpath.setContent(TEST_STR) PathTesterItem(store=s, relpath=fpath) s.close() os.rename(spath, npath) s2 = Store(npath) pti = list(s2.query(PathTesterItem))[0] self.assertEquals(pti.relpath.getContent(), TEST_STR) return rel.close().addCallback(cb)
def testRelocatingPaths(self): spath = self.mktemp() npath = self.mktemp() s = Store(spath) rel = s.newFile("test", "123") TEST_STR = "test 123" def cb(fpath): fpath.setContent(TEST_STR) PathTesterItem(store=s, relpath=fpath) s.close() os.rename(spath, npath) s2 = Store(npath) pti = list(s2.query(PathTesterItem))[0] self.assertEqual(pti.relpath.getContent(), TEST_STR) return rel.close().addCallback(cb)