Пример #1
0
 def _setup(self, mock_requests):
     """Test the setup."""
     self.mock_post = mock_requests.post
     self.mock_request_exception = Exception
     mock_requests.exceptions.RequestException = self.mock_request_exception
     config = {
         'logentries': {
             'host': 'https://webhook.logentries.com/noformat/logs/token',
             'token': 'token'
         }
     }
     self.hass = mock.MagicMock()
     logentries.setup(self.hass, config)
     self.handler_method = self.hass.bus.listen.call_args_list[0][0][1]
Пример #2
0
 def _setup(self, mock_requests):
     """Test the setup."""
     self.mock_post = mock_requests.post
     self.mock_request_exception = Exception
     mock_requests.exceptions.RequestException = self.mock_request_exception
     config = {
         'logentries': {
             'host': 'https://webhook.logentries.com/noformat/logs/token',
             'token': 'token'
         }
     }
     self.hass = mock.MagicMock()
     logentries.setup(self.hass, config)
     self.handler_method = self.hass.bus.listen.call_args_list[0][0][1]
Пример #3
0
 def test_setup_config_defaults(self):
     """Test setup with defaults."""
     config = {
         'logentries': {
             'host': 'host',
             'token': 'token',
         }
     }
     hass = mock.MagicMock()
     self.assertTrue(logentries.setup(hass, config))
     self.assertTrue(hass.bus.listen.called)
     self.assertEqual(EVENT_STATE_CHANGED,
                      hass.bus.listen.call_args_list[0][0][0])
Пример #4
0
 def test_setup_config_defaults(self):
     """Test setup with defaults."""
     config = {
         'logentries': {
             'host': 'host',
             'token': 'token',
         }
     }
     hass = mock.MagicMock()
     self.assertTrue(logentries.setup(hass, config))
     self.assertTrue(hass.bus.listen.called)
     self.assertEqual(EVENT_STATE_CHANGED,
                      hass.bus.listen.call_args_list[0][0][0])