Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_prune_intervals(app, qtbot):
prune_intervals = ['hour', 'day', 'week', 'month', 'year']
main = app.main_window
tab = main.archiveTab
profile = BackupProfileModel.get(id=1)
for i in prune_intervals:
getattr(tab, f'prune_{i}').setValue(9)
tab.save_prune_setting(None)
profile = profile.refresh()
assert getattr(profile, f'prune_{i}') == 9
def profile_select_action(self, index):
self.current_profile = BackupProfileModel.get(id=self.profileSelector.currentData())
self.archiveTab.populate_from_profile()
self.repoTab.populate_from_profile()
self.sourceTab.populate_from_profile()
self.scheduleTab.populate_from_profile()
def profile_delete_action(self):
if self.profileSelector.count() > 1:
to_delete = BackupProfileModel.get(id=self.profileSelector.currentData())
# Remove pending background jobs
to_delete_id = str(to_delete.id)
if self.app.scheduler.get_job(to_delete_id):
self.app.scheduler.remove_job(to_delete_id)
to_delete.delete_instance(recursive=True)
self.profileSelector.removeItem(self.profileSelector.currentIndex())
self.profile_select_action(0)