def test_find_existing_jobs(self): """Test uninstalling tasks with the ``uninstalltasks`` command.""" keep = '%(python)s %(manage)s runtask' % { 'python': KRONOS_PYTHON, 'manage': KRONOS_MANAGE, } keep2 = " keep_me $KRONOS_BREAD_CRUMB" remove = keep + keep2 new_cron = find_existing_jobs("\n".join([keep, keep2, remove, ""])) self.assertIn(keep, new_cron) self.assertIn(keep2, new_cron) self.assertNotIn(remove, new_cron)
def test_find_existing_jobs(self): """Test uninstalling tasks with the ``uninstalltasks`` command.""" env = """EXISTING1=other1 # KRONOS_ENV_BREAD_CRUMB for next line INSERTED_BY_KRONOS=important EXISTING2=other2 """ keep = '%(python)s %(manage)s runtask' % { 'python': KRONOS_PYTHON, 'manage': KRONOS_MANAGE, } keep2 = " keep_me $KRONOS_BREAD_CRUMB" remove = keep + keep2 new_cron = find_existing_jobs(env + "\n".join([ keep, keep2, remove, ""])) self.assertIn(keep, new_cron) self.assertIn(keep2, new_cron) self.assertNotIn(remove, new_cron) self.assertIn('EXISTING1', new_cron) self.assertIn('EXISTING2', new_cron) self.assertNotIn('KRONOS_ENV_BREAD_CRUMB', new_cron) self.assertNotIn('INSERTED_BY_KRONOS', new_cron)