def testCopyFile(self):
"""Tests if the copying of a file none existing beforhand works."""
expected_content = "this is test content."
with tempfile.TemporaryDirectory() as tmpdir:
source = os.path.join(tmpdir, self.file)
destination = os.path.join(tmpdir, "copy", self.file)
with open(source, "a") as f:
f.write(expected_content)
handler = file_handler.FileHandler()
self.assertFalse(os.path.exists(destination))
handler.CopyFile(source, destination)
self.assertTrue(os.path.exists(destination))
self.assertTrue(filecmp.cmp(destination, source))
评论列表
文章目录