def test_archive_ss_data_pass(self): ss._archive_ss_data( self.archive_test_file ) # Assert that the original file was removed. self.assertFalse(os.path.isfile(self.archive_test_file)) # Assert that the new archive file exists. base_name = os.path.basename(self.archive_test_file) expected = os.path.join(self.temp_dir, 'backup', base_name) self.assertTrue(os.path.isfile(expected)) return None
def test_archive_read_only_file_pass(self): this_dir_path = os.path.dirname(self.archive_test_file) backup_dir_path = os.path.join(this_dir_path, 'backup') archive_file_name = os.path.basename(self.archive_test_file) archive_file_path = os.path.join(backup_dir_path, archive_file_name) os.chmod(self.archive_test_file, stat.S_IREAD) ss._archive_ss_data( self.archive_test_file ) self.assertTrue(os.path.isfile(archive_file_path)) self.assertFalse(os.path.isfile(self.archive_test_file)) return None