Пример #1
0
 def test_custom_csv(self):
     args = ['--csv', './test_data.csv', '-n']
     otrs_search.get_args(args)
     csvfile = open('./test_data.csv', 'rb')
     otrs_search.show_tickets(csvfile)
     lines = sys.stdout.getvalue().split('\n')
     self.assertEquals(len(lines), 6)
Пример #2
0
 def test_custom_csv(self):
     args = ['--csv', './test_data.csv', '-n']
     otrs_search.get_args(args)
     csvfile = open('./test_data.csv', 'rb')
     otrs_search.show_tickets(csvfile)
     lines = sys.stdout.getvalue().split('\n')
     self.assertEquals(len(lines), 6)
Пример #3
0
 def test_queues(self):
     args = ['-Q']
     try:
         otrs_search.get_args(args)
     except SystemExit, e:
         out = sys.stdout.getvalue()
         self.assertIsNotNone(re.search('\d+ -*', out))
         self.assertEquals(e.code, 0)
Пример #4
0
 def test_queues(self):
     args = ['-Q']
     try:
         otrs_search.get_args(args)
     except SystemExit, e:
         out = sys.stdout.getvalue().split('\n')[:-1]
         for l in out:
             self.assertIsNotNone(re.match('^\d{1,3} [\ \.\-_0-9\w]*$', l.encode('ascii', 'ignore')))
         self.assertEquals(e.code, 0)
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
 def test_queues(self):
     args = ['-Q']
     try:
         otrs_search.get_args(args)
     except SystemExit, e:
         out = sys.stdout.getvalue().split('\n')[:-1]
         for l in out:
             self.assertIsNotNone(
                 re.match('^\d{1,3} [\ \.\-_0-9\w]*$',
                          l.encode('ascii', 'ignore')))
         self.assertEquals(e.code, 0)