def test_insert(self): report = Report(self.env) report.title = "The report" report.description = "The description" report.query = "SELECT 1" report.insert() self.assertEqual(9, report.id)
def test_update_report(self): report = Report(self.env) report.query = "SELECT 1" report.insert() req = MockRequest(self.env, method='POST', args={ 'action': 'edit', 'id': '1', 'title': "New Report edited", 'query': "SELECT 2", 'description': "The description edited"}) self.assertRaises(RequestDone, self.report_module.process_request, req) report = Report(self.env, 1) self.assertEqual("New Report edited", report.title) self.assertEqual("SELECT 2", report.query) self.assertEqual("The description edited", report.description) self.assertIn("Your changes have been saved.", req.chrome['notices'])
def test_update_report_cancel(self): report = Report(self.env) report.query = "SELECT 1" report.insert() req = MockRequest(self.env, method='POST', args={ 'action': 'edit', 'cancel': True, 'id': '1', 'title': "New Report edited", 'query': "SELECT 2", 'description': "The description edited"}) self.assertRaises(RequestDone, self.report_module.process_request, req) report = Report(self.env, 1) self.assertEqual("Active Tickets", report.title) self.assertEqual(" * List all active tickets by priority.\n" " * Color each row based on priority.\n", report.description) self.assertIn("SELECT p.value AS __color__", report.query) self.assertNotIn("Your changes have been saved.", req.chrome['notices'])