def test_snooze_time(self): """ Test the accessor for the db snooze time setting. """ adh = AlarmDb(self.db_name) # Valid data success = adh.set_snooze_time(5) self.assertTrue(success) self.assertEquals(adh.get_snooze_time(), 5) # Invalid data should maintain old value success = adh.set_snooze_time(-1) self.assertFalse(success) self.assertEquals(adh.get_snooze_time(), 5) success = adh.set_snooze_time(2.5) self.assertFalse(success) self.assertEquals(adh.get_snooze_time(), 5) success = adh.set_snooze_time('3') self.assertFalse(success) self.assertEquals(adh.get_snooze_time(), 5)
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)