def backup_needed(lower_folder, upper_folder, delta, lower_date, upper_date): """Set timestamp to folder and checks whether function result matches given result.""" os.system('touch -t {time:%Y%m%d%H%M.%S} {file}'.format(time=lower_date, file=lower_folder)) os.system('touch -t {time:%Y%m%d%H%M.%S} {file}'.format(time=upper_date, file=upper_folder)) return level_backup_needed(upper_folder, lower_folder, delta)
def test_non_existing_both(lower_folder, upper_folder, delta): non_existing_lower = os.path.join(lower_folder, 'lower') non_existing_upper = os.path.join(upper_folder, 'upper') assert not level_backup_needed(non_existing_upper, non_existing_lower, delta)
def test_non_existing_upper(lower_folder, upper_folder, delta): non_existing_upper = os.path.join(upper_folder, 'upper') assert level_backup_needed(non_existing_upper, lower_folder, delta)