Beispiel #1
0
 def test_copy_file(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction()
     trn.copy(self.path("file1"), self.path("file2"))
     self.assertContents("file1", "hello world")
     self.assertFalse(os.path.exists(self.path("file2")))
     trn.commit()
     self.assertContents("file1", "hello world")
     self.assertContents("file2", "hello world")
Beispiel #2
0
 def test_copy_dir_over_file(self):
     self.setContents("dir1/file0", "zero zero zero")
     self.setContents("dir2", "actually a file")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file0", "zero zero zero")
     trn.commit()
     self.assertContents("dir2/file0", "zero zero zero")
     self.assertContents("dir1/file0", "zero zero zero")
Beispiel #3
0
 def test_copy_dir_over_file(self):
     self.setContents("dir1/file0", "zero zero zero")
     self.setContents("dir2", "actually a file")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file0", "zero zero zero")
     trn.commit()
     self.assertContents("dir2/file0", "zero zero zero")
     self.assertContents("dir1/file0", "zero zero zero")
Beispiel #4
0
 def test_copy_file(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction()
     trn.copy(self.path("file1"), self.path("file2"))
     self.assertContents("file1", "hello world")
     self.assertFalse(os.path.exists(self.path("file2")))
     trn.commit()
     self.assertContents("file1", "hello world")
     self.assertContents("file2", "hello world")
Beispiel #5
0
 def test_copy_file_over_dir(self):
     self.setContents("file0", "zero zero zero")
     self.setContents("dir2/myfile", "hahahahaha!")
     trn = FSTransaction()
     trn.copy(self.path("file0"), self.path("dir2"))
     self.assertContents("file0", "zero zero zero")
     self.assertContents("dir2/myfile", "hahahahaha!")
     trn.commit()
     self.assertContents("dir2", "zero zero zero")
     self.assertContents("file0", "zero zero zero")
Beispiel #6
0
 def test_copy_file_over_dir(self):
     self.setContents("file0", "zero zero zero")
     self.setContents("dir2/myfile", "hahahahaha!")
     trn = FSTransaction()
     trn.copy(self.path("file0"), self.path("dir2"))
     self.assertContents("file0", "zero zero zero")
     self.assertContents("dir2/myfile", "hahahahaha!")
     trn.commit()
     self.assertContents("dir2", "zero zero zero")
     self.assertContents("file0", "zero zero zero")
Beispiel #7
0
 def test_copy_dir(self):
     self.setContents("dir1/file1", "hello world")
     self.setContents("dir1/file2", "how are you?")
     self.setContents("dir1/subdir/file3", "fine thanks")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file1", "hello world")
     self.assertFalse(os.path.exists(self.path("dir2")))
     trn.commit()
     self.assertContents("dir2/file1", "hello world")
     self.assertContents("dir2/file2", "how are you?")
     self.assertContents("dir2/subdir/file3", "fine thanks")
     self.assertContents("dir1/file1", "hello world")
     self.assertContents("dir1/file2", "how are you?")
     self.assertContents("dir1/subdir/file3", "fine thanks")
Beispiel #8
0
 def test_copy_dir(self):
     self.setContents("dir1/file1", "hello world")
     self.setContents("dir1/file2", "how are you?")
     self.setContents("dir1/subdir/file3", "fine thanks")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file1", "hello world")
     self.assertFalse(os.path.exists(self.path("dir2")))
     trn.commit()
     self.assertContents("dir2/file1", "hello world")
     self.assertContents("dir2/file2", "how are you?")
     self.assertContents("dir2/subdir/file3", "fine thanks")
     self.assertContents("dir1/file1", "hello world")
     self.assertContents("dir1/file2", "how are you?")
     self.assertContents("dir1/subdir/file3", "fine thanks")