def test_date_format(self): args = ['-n', '-f', 'YYYY-MM-DD '] otrs_search.get_args(args) res = otrs_search.get_tickets() csvfile = otrs_search.write_data(res) otrs_search.show_tickets(csvfile) lines = sys.stdout.getvalue().split('\n') for l in lines[1:-2]: r = re.match(u'^\x1b\[0;32m\d{4}-\d{2}-\d{2} \x1b\[0;34m\d{7}', l) self.assertNotEqual(r, None)
def search(self, args): otrs_search.get_args(args) res = otrs_search.get_tickets() csvfile = otrs_search.write_data(res) try: otrs_search.show_tickets(csvfile) except SystemExit, e: out = sys.stdout.getvalue() a = 'ticket(s)' in out self.assertTrue(a) self.assertEquals(e.code, 0)