Exemplo n.º 1
0
 def test_update_laptimer_raises_exception_when_laptimer_is_invalid(self):
     # Arrange
     laptimer = json.loads('{"bogus": "bogus"}')
     # Act
     with self.assertRaises(Exception) as context:
         update.update_laptimer(self.config_file, self.config, laptimer)
     # Assert
     expected = "Unknown attribute 'bogus' in laptimer configuration"
     self.assertEqual(context.exception.message, expected)
Exemplo n.º 2
0
 def test_update_laptimer_raises_exception_when_laptimer_is_invalid(self):
     # Arrange
     laptimer = json.loads('{"bogus": "bogus"}')
     # Act
     with self.assertRaises(Exception) as context:
         update.update_laptimer(self.config_file, self.config, laptimer)
     # Assert
     expected = "Unknown attribute 'bogus' in laptimer configuration"
     self.assertEqual(context.exception.message, expected)
Exemplo n.º 3
0
 def test_update_laptimer_merges_existing_configuration(self):
     # Arrange
     laptimer = json.loads('{"name": "bogus"}')
     # Act
     config = update.update_laptimer(self.config_file, self.config,
                                     laptimer)
     # Assert
     self.assertEqual(config['laptimer']['name'], 'bogus')
Exemplo n.º 4
0
 def test_update_laptimer_merges_existing_configuration(self):
     # Arrange
     laptimer = json.loads('{"name": "bogus"}')
     # Act
     config = update.update_laptimer(self.config_file, self.config,
                                     laptimer)
     # Assert
     self.assertEqual(config['laptimer']['name'], 'bogus')
Exemplo n.º 5
0
 def update_laptimer(self, laptimer):
     config = update.update_laptimer(self.config_file, self.config,
                                     laptimer)
     if "laptimer" in config:
         self.config = config
         self._publish("laptimer_changed", config["laptimer"])