def test_templates_need_update_true(self): """Templates need to be updated.""" self.env.config.set('notification', 'ticket_subject_template', '$prefix #$ticket.id: $summary') self.env.config.set('notification', 'batch_subject_template', '$prefix Batch modify: $tickets_descr') self.env.config.save() db45.do_upgrade(self.env, None, None) self.assertIn(('INFO', 'Replaced value of [notification] ' 'ticket_subject_template: $prefix #$ticket.id: ' '$summary -> ${prefix} #${ticket.id}: ${summary}'), self.env.log_messages) self.assertIn(('INFO', 'Replaced value of [notification] ' 'batch_subject_template: $prefix Batch modify: ' '$tickets_descr -> ${prefix} Batch modify: ' '${tickets_descr}'), self.env.log_messages) parser = UnicodeConfigParser() parser.read(self.env.config.filename) self.assertEqual('${prefix} #${ticket.id}: ${summary}', parser.get('notification', 'ticket_subject_template')) self.assertEqual('${prefix} Batch modify: ${tickets_descr}', parser.get('notification', 'batch_subject_template')) self.assertTrue(self._backup_file_exists())
def test_templates_need_update_false(self): """Templates don't need to be updated.""" self.env.config.set('notification', 'ticket_subject_template', '${prefix} #${ticket.id}: ${summary}') self.env.config.set('notification', 'batch_subject_template', '${prefix} Batch modify: ${tickets_descr}') self.env.config.save() db45.do_upgrade(self.env, None, None) self.assertEqual([], self.env.log_messages) self.assertFalse(self._backup_file_exists())