def setUp(self): backup = Backup() root = backup.config[Backup.sessions_config][0].source_directory file = TestFile(root + 'text_file.txt', FileType.text, '1k', 1) file.create_checksum() file.set_attributes() backup.backup_start()
def test_get_file_checksum_calc(self): file = TestFile('text_file.txt', FileType.text, '1k', 1) file.create_checksum() file.set_attributes() file_name = 'text_file.txt' checksum_calc = Backup.get_file_checksum_calc(file_name) sum_name = file_name + '.sum' file = open(sum_name) checksum_read = file.read().split(" ")[0] file.close() self.assertEqual(checksum_calc, checksum_read) os.remove('text_file.txt') os.remove('text_file.txt.sum')