Exemplo n.º 1
0
 def test_main(self):
     """Test that dbchk doesn't work."""
     cmd('dbsync')
     cmd('dbsync')
     hit_exception = False
     try:
         main('--stop-after-a-moment', '--cpconfig',
              os.path.join(os.path.dirname(__file__), '..', 'server.conf'))
     # pylint: disable=broad-except
     except Exception:
         hit_exception = True
     self.assertFalse(hit_exception)
Exemplo n.º 2
0
 def setUp(cls):
     """Call super method and create some data in the db."""
     super().setUp()
     cmd('dbsync')
     for event_match_hash in cls.event_match_objs:
         event_match_obj = EventMatch(**event_match_hash)
         event_match_obj.save(force_insert=True)
     for event_log_hash in cls.event_log_objs:
         event_log_obj = EventLog(**event_log_hash)
         event_log_obj.save(force_insert=True)
     for event_log_match_hash in cls.event_log_match_objs:
         event_log_match_obj = EventLogMatch(**event_log_match_hash)
         event_log_match_obj.save(force_insert=True)
Exemplo n.º 3
0
 def test_dbsync(self):
     """Run the update by calling dbsync."""
     self.assertEqual(cmd('dbsync'), 0)
Exemplo n.º 4
0
 def test_dbchk_equal(self):
     """Test that dbchk doesn't work."""
     self.assertEqual(cmd('dbchk', '--equal'), -1)
Exemplo n.º 5
0
 def test_eventpurge(self):
     """Test some eventpurge."""
     self.assertEqual(cmd('eventpurge'), 0)
Exemplo n.º 6
0
 def test_eventpurge_with_args(self):
     """Test some of the uuid arguments with eventpurge."""
     self.assertEqual(
         cmd('eventpurge', '--older-than-date', '2199-01-01 00:00:00'), 0)
Exemplo n.º 7
0
 def test_eventpurge_with_uuids(self):
     """Test some of the uuid arguments with eventpurge."""
     self.assertEqual(
         cmd('eventpurge', '9419b5b6-6f11-439a-9585-42e272c97da4'), 0)
Exemplo n.º 8
0
 def test_eventget_wrong_order(self):
     """Test the reverse of start and end time."""
     with self.assertRaises(ValueError):
         cmd('eventget', '--start-date', '2020-03-01 00:00:00',
             '--end-date', '2020-02-01 00:00:00')
Exemplo n.º 9
0
 def test_eventget_with_args(self):
     """Test some of the arguments with eventget."""
     self.assertEqual(
         cmd('eventget', '--start-date', '2020-01-01 00:00:00',
             '--end-date', '2020-02-01 00:00:00'), 0)
Exemplo n.º 10
0
 def test_eventget(self):
     """Test that dbchk doesn't work."""
     self.assertEqual(cmd('eventget'), 0)
Exemplo n.º 11
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Test script to run the command interface for testing."""
from pacifica.notifications.__main__ import cmd

if __name__ == '__main__':
    exit(cmd())