Example #1
0
 def test_dummy_alarms(self):
     """
     Tests that if the database is empty it will populate it with the dummy
     alarms.
     This also accesses the static methods from a AlarmManager() instacne.
     """
     alarm_mgr = AlarmManager()
     alarm_mgr.delete_all_alarms()
     self.assertEqual(alarm_mgr.get_number_of_alarms(), 0)
     alarm_mgr = AlarmManager()
     self.assertNotEqual(alarm_mgr.get_number_of_alarms(), 0)
 def test_dummy_alarms(self):
     """
     Tests that if the database is empty it will populate it with the dummy
     alarms.
     This also accesses the static methods from a AlarmManager() instacne.
     """
     alarm_mgr = AlarmManager()
     alarm_mgr.delete_all_alarms()
     self.assertEqual(alarm_mgr.get_number_of_alarms(), 0)
     alarm_mgr = AlarmManager()
     self.assertNotEqual(alarm_mgr.get_number_of_alarms(), 0)
Example #3
0
 def test_delete_all_alarms(self):
     """
     Adds 5 alarms to the database, checks there are alarms in the db and
     proceeds to delete them all and check.
     """
     alarm_mgr = AlarmManager()
     self.create_alarms(alarm_mgr)
     numb_alarms = AlarmManager.get_number_of_alarms()
     self.assertGreater(numb_alarms, 0)
     delete_success = alarm_mgr.delete_all_alarms()
     self.assertTrue(delete_success)
     self.assertEqual(AlarmManager.get_number_of_alarms(), 0)
 def test_delete_all_alarms(self):
     """
     Adds 5 alarms to the database, checks there are alarms in the db and
     proceeds to delete them all and check.
     """
     alarm_mgr = AlarmManager()
     self.create_alarms(alarm_mgr)
     numb_alarms = AlarmManager.get_number_of_alarms()
     self.assertGreater(numb_alarms, 0)
     delete_success = alarm_mgr.delete_all_alarms()
     self.assertTrue(delete_success)
     self.assertEqual(AlarmManager.get_number_of_alarms(), 0)
Example #5
0
 def test_delete_alarm(self):
     """
     Adds 5 alarms to the database, checks it is able to retrieve one of
     them and proceeds to delete and check it has been deleted.
     """
     alarm_mgr = AlarmManager()
     self.create_alarms(alarm_mgr)
     numb_alarms = AlarmManager.get_number_of_alarms()
     self.assertGreater(numb_alarms, 0)
     all_alarms = AlarmManager.get_all_alarms()
     alarm_retrieved = AlarmManager.get_alarm(all_alarms[0].id_)
     self.assertIsNotNone(alarm_retrieved)
     delete_success = alarm_mgr.delete_alarm(1)
     self.assertTrue(delete_success)
     self.assertLess(AlarmManager.get_number_of_alarms(), numb_alarms)
     alarm_retrieved = AlarmManager.get_alarm(alarm_retrieved.id_)
     self.assertIsNone(alarm_retrieved)
 def test_delete_alarm(self):
     """
     Adds 5 alarms to the database, checks it is able to retrieve one of
     them and proceeds to delete and check it has been deleted.
     """
     alarm_mgr = AlarmManager()
     self.create_alarms(alarm_mgr)
     numb_alarms = AlarmManager.get_number_of_alarms()
     self.assertGreater(numb_alarms, 0)
     all_alarms = AlarmManager.get_all_alarms()
     alarm_retrieved = AlarmManager.get_alarm(all_alarms[0].id_)
     self.assertIsNotNone(alarm_retrieved)
     delete_success = alarm_mgr.delete_alarm(1)
     self.assertTrue(delete_success)
     self.assertLess(AlarmManager.get_number_of_alarms(), numb_alarms)
     alarm_retrieved = AlarmManager.get_alarm(alarm_retrieved.id_)
     self.assertIsNone(alarm_retrieved)