Ejemplo n.º 1
0
 def test_must_ring_bell_now_not_active(self):
     # given
     alarm = Alarm(0, 10, 00)
     alarm.isActive = False
     # when
     result = watch_alarms._must_ring_bell_now(alarm)
     # then
     self.assertFalse(result)
Ejemplo n.º 2
0
 def testActivateBell(self, mock_get_stop_the_bell_settings):
     #given
     alarm = Alarm(1, 21, 54)
     alarm.stopTheBellSettings = None
     alarm.fadeInSetting = None
     mock_get_stop_the_bell_settings.return_value = None
     # when
     bell.activate_new_bell(alarm)
     # then
     self.assertIsNotNone(bell.current_bell)
Ejemplo n.º 3
0
 def test_must_ring_bell_now_monday_negative(self):
     # given
     alarm = Alarm(0, 10, 00)
     repetition = RepeatAlarm()
     repetition.days = [1]
     alarm.repetition = repetition
     # when
     result = watch_alarms._must_ring_bell_now(alarm)
     # then
     self.assertFalse(result)
Ejemplo n.º 4
0
 def test_must_ring_bell_wrong_time(self):
     '''
     This should return false as the alarm time is not now (now is mocked).
     '''
     # given: an alarm at 11:00
     alarm = Alarm(0, 11, 00)
     # when: checking if alarm must ring bell
     result = watch_alarms._must_ring_bell_now(alarm)
     # then: false, as (mocked) now is not 11:00
     self.assertFalse(result)
Ejemplo n.º 5
0
 def testActivateBellOnlyOnce(self, mock_get_stop_the_bell_settings):
     #given
     mock_get_stop_the_bell_settings.return_value = None
     alarm1 = Alarm(1, 21, 54)
     alarm1.stopTheBellSettings = None
     alarm1.fadeInSetting = None
     alarm2 = Alarm(1, 21, 54)
     alarm2.stopTheBellSettings = None
     alarm2.fadeInSetting = None
     bell.activate_new_bell(alarm1)
     bell1 = bell.current_bell
     # when
     bell.activate_new_bell(alarm2)
     # then
     self.assertEqual(bell.current_bell, bell1)
Ejemplo n.º 6
0
 def testActivatingNewBellTurnsOffCurrentBell(
         self, mock_get_stop_the_bell_settings):
     #given
     mock_get_stop_the_bell_settings.return_value = None
     alarm1 = Alarm(1, 21, 54)
     alarm1.stopTheBellSettings = None
     alarm1.fadeInSetting = None
     theBell = bell.Bell(alarm1)
     theBell.timeStarted = datetime.strptime('8/18/2008', "%m/%d/%Y")
     bell.current_bell = theBell
     alarm2 = Alarm(1, 22, 54)
     alarm2.stopTheBellSettings = None
     alarm2.fadeInSetting = None
     # when
     bell.activate_new_bell(alarm2)
     # then
     self.assertFalse(theBell.isActive)
Ejemplo n.º 7
0
 def test_must_ring_bell_now_no_repeat(self):
     alarm = Alarm(0, 10, 00)
     result = watch_alarms._must_ring_bell_now(alarm)
     self.assertTrue(result)