示例#1
0
文件: test_esky.py 项目: orng/esky
 def test_no_move_outside_root(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction(self.testdir)
     trn.move(self.path("file1"), "file2")
     trn.commit()
     self.assertContents("file2", "hello world")
     trn = FSTransaction(self.testdir)
     self.assertRaises(ValueError, trn.move, self.path("file2"), "../file1")
     trn.abort()
示例#2
0
 def test_no_move_outside_root(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction(self.testdir)
     trn.move(self.path("file1"), "file2")
     trn.commit()
     self.assertContents("file2", "hello world")
     trn = FSTransaction(self.testdir)
     self.assertRaises(ValueError, trn.move, self.path("file2"), "../file1")
     trn.abort()
示例#3
0
文件: test_esky.py 项目: orng/esky
 def test_remove_abort(self):
     self.setContents("dir1/file1", "hello there world")
     trn = FSTransaction()
     trn.remove(self.path("dir1/file1"))
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn.abort()
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn = FSTransaction()
     trn.remove(self.path("dir1"))
     trn.abort()
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn = FSTransaction()
     trn.remove(self.path("dir1"))
     trn.commit()
     self.assertFalse(os.path.exists(self.path("dir1")))
示例#4
0
 def test_remove_abort(self):
     self.setContents("dir1/file1", "hello there world")
     trn = FSTransaction()
     trn.remove(self.path("dir1/file1"))
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn.abort()
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn = FSTransaction()
     trn.remove(self.path("dir1"))
     trn.abort()
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn = FSTransaction()
     trn.remove(self.path("dir1"))
     trn.commit()
     self.assertFalse(os.path.exists(self.path("dir1")))