Пример #1
0
 def test_set_all(self):
   c = Client()
   response = c.post('/nabclockd/settings', {'chime_hour': 'false', 'wakeup_time': '09:42', 'sleep_time': '21:21'})
   self.assertEqual(response.status_code, 200)
   self.assertEqual(response.templates[0].name, 'nabclockd/settings.html')
   self.assertTrue('config' in response.context)
   config = Config.load()
   self.assertEqual(response.context['config'], config)
   self.assertEqual(config.chime_hour, False)
   self.assertEqual(config.wakeup_hour, 9)
   self.assertEqual(config.wakeup_min, 42)
   self.assertEqual(config.sleep_hour, 21)
   self.assertEqual(config.sleep_min, 21)
Пример #2
0
 def test_get_settings(self):
   c = Client()
   response = c.get('/nabclockd/settings')
   self.assertEqual(response.status_code, 200)
   self.assertEqual(response.templates[0].name, 'nabclockd/settings.html')
   self.assertTrue('config' in response.context)
   config = Config.load()
   self.assertEqual(response.context['config'], config)
   self.assertEqual(config.chime_hour, True)
   self.assertEqual(config.wakeup_hour, 7)
   self.assertEqual(config.wakeup_min, 0)
   self.assertEqual(config.sleep_hour, 22)
   self.assertEqual(config.sleep_min, 0)
Пример #3
0
 def test_set_sleep_time(self):
     c = Client()
     response = c.post("/nabclockd/settings", {"sleep_time": "21:21"})
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.templates[0].name, "nabclockd/settings.html")
     self.assertTrue("config" in response.context)
     config = Config.load()
     self.assertEqual(response.context["config"], config)
     self.assertEqual(config.chime_hour, True)
     self.assertEqual(config.wakeup_hour, 7)
     self.assertEqual(config.wakeup_min, 0)
     self.assertEqual(config.sleep_hour, 21)
     self.assertEqual(config.sleep_min, 21)
Пример #4
0
 def test_set_all(self):
     c = Client()
     response = c.post(
         "/nabclockd/settings",
         {
             "chime_hour": "false",
             "wakeup_time": "09:42",
             "sleep_time": "21:21",
         },
     )
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.templates[0].name, "nabclockd/settings.html")
     self.assertTrue("config" in response.context)
     config = Config.load()
     self.assertEqual(response.context["config"], config)
     self.assertEqual(config.chime_hour, False)
     self.assertEqual(config.wakeup_hour, 9)
     self.assertEqual(config.wakeup_min, 42)
     self.assertEqual(config.sleep_hour, 21)
     self.assertEqual(config.sleep_min, 21)
Пример #5
0
 def test_set_chime_hour(self):
     c = Client()
     response = c.post("/nabclockd/settings", {"chime_hour": "false"})
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.templates[0].name, "nabclockd/settings.html")
     self.assertTrue("config" in response.context)
     config = Config.load()
     self.assertEqual(response.context["config"], config)
     self.assertEqual(config.chime_hour, False)
     self.assertEqual(config.wakeup_hour, 7)
     self.assertEqual(config.wakeup_min, 0)
     self.assertEqual(config.sleep_hour, 22)
     self.assertEqual(config.sleep_min, 0)
     self.assertEqual(config.wakeup_hour_monday, 7)
     self.assertEqual(config.wakeup_min_monday, 0)
     self.assertEqual(config.sleep_hour_monday, 22)
     self.assertEqual(config.sleep_min_monday, 0)
     self.assertEqual(config.wakeup_hour_tuesday, 7)
     self.assertEqual(config.wakeup_min_tuesday, 0)
     self.assertEqual(config.sleep_hour_tuesday, 22)
     self.assertEqual(config.sleep_min_tuesday, 0)
     self.assertEqual(config.wakeup_hour_wednesday, 7)
     self.assertEqual(config.wakeup_min_wednesday, 0)
     self.assertEqual(config.sleep_hour_wednesday, 22)
     self.assertEqual(config.sleep_min_wednesday, 0)
     self.assertEqual(config.wakeup_hour_thursday, 7)
     self.assertEqual(config.wakeup_min_thursday, 0)
     self.assertEqual(config.sleep_hour_thursday, 22)
     self.assertEqual(config.sleep_min_thursday, 0)
     self.assertEqual(config.wakeup_hour_friday, 7)
     self.assertEqual(config.wakeup_min_friday, 0)
     self.assertEqual(config.sleep_hour_friday, 22)
     self.assertEqual(config.sleep_min_friday, 0)
     self.assertEqual(config.wakeup_hour_saturday, 7)
     self.assertEqual(config.wakeup_min_saturday, 0)
     self.assertEqual(config.sleep_hour_saturday, 22)
     self.assertEqual(config.sleep_min_saturday, 0)
     self.assertEqual(config.wakeup_hour_sunday, 7)
     self.assertEqual(config.wakeup_min_sunday, 0)
     self.assertEqual(config.sleep_hour_sunday, 22)
     self.assertEqual(config.sleep_min_sunday, 0)
Пример #6
0
 def setUp(self):
   Config.reset_cache()
   Config.load()
Пример #7
0
 def setUp(self):
     Config.load()