Exemplo n.º 1
0
    def test_offset_alert_time(self):
        """ Test the accessor for the db offset_alert time setting. """
        adh = AlarmDb(self.db_name)

        # Valid negative data
        success = adh.set_offset_alert_time(-1)
        self.assertTrue(success)
        self.assertEquals(adh.get_offset_alert_time(), -1)

        # Valid positive data
        success = adh.set_offset_alert_time(5)
        self.assertTrue(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)

        # Invalid data should maintain old value
        success = adh.set_offset_alert_time(2.5)
        self.assertFalse(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)

        success = adh.set_offset_alert_time('3')
        self.assertFalse(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)
Exemplo n.º 2
0
    def test_offset_alert_time(self):
        """ Test the accessor for the db offset_alert time setting. """
        adh = AlarmDb(self.db_name)

        # Valid negative data
        success = adh.set_offset_alert_time(-1)
        self.assertTrue(success)
        self.assertEquals(adh.get_offset_alert_time(), -1)

        # Valid positive data
        success = adh.set_offset_alert_time(5)
        self.assertTrue(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)

        # Invalid data should maintain old value
        success = adh.set_offset_alert_time(2.5)
        self.assertFalse(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)

        success = adh.set_offset_alert_time('3')
        self.assertFalse(success)
        self.assertEquals(adh.get_offset_alert_time(), 5)
Exemplo n.º 3
0
    def test_reset_settings(self):
        """ Test reset settings. """
        adh = AlarmDb(self.db_name)
        success = adh.set_snooze_time(321)
        self.assertTrue(success)
        success = adh.set_offset_alert_time(123)
        self.assertTrue(success)
        self.assertEquals(adh.get_snooze_time(), 321)
        self.assertEquals(adh.get_offset_alert_time(), 123)

        success = adh.reset_settings()
        self.assertTrue(success)
        self.assertNotEquals(adh.get_snooze_time(), 321)
        self.assertNotEquals(adh.get_offset_alert_time(), 123)
Exemplo n.º 4
0
    def test_reset_settings(self):
        """ Test reset settings. """
        adh = AlarmDb(self.db_name)
        success = adh.set_snooze_time(321)
        self.assertTrue(success)
        success = adh.set_offset_alert_time(123)
        self.assertTrue(success)
        self.assertEquals(adh.get_snooze_time(), 321)
        self.assertEquals(adh.get_offset_alert_time(), 123)

        success = adh.reset_settings()
        self.assertTrue(success)
        self.assertNotEquals(adh.get_snooze_time(), 321)
        self.assertNotEquals(adh.get_offset_alert_time(), 123)