def test_copy_file_dirty_not_modified(self, src_dir, dest_dir): file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) file.is_modified = mock.Mock(return_value=False) dest_path = os.path.join(dest_dir, 'test.txt') file.copy_file(dirty=True) self.assertPathIsFile(dest_path) with open(dest_path, 'r', encoding='utf-8') as f: self.assertEqual(f.read(), 'destination content')
def test_copy_file(self, src_dir, dest_dir): file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) dest_path = os.path.join(dest_dir, 'test.txt') self.assertPathNotExists(dest_path) file.copy_file() self.assertPathIsFile(dest_path)