Пример #1
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     with pytest.raises(MissingSchema):
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'localhost',
             'method': 'GET'
         }, None)
Пример #2
0
 def test_setup_timeout(self, mock_req):
     """Test setup when connection timeout occurs."""
     with raises(PlatformNotReady):
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         }, self.add_devices, None)
     assert len(self.DEVICES) == 0
Пример #3
0
 def test_setup_failed_connect(self, mock_req):
     """Test setup when connection error occurs."""
     with raises(PlatformNotReady):
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         }, self.add_devices, None)
     self.assertEqual(len(self.DEVICES), 0)
Пример #4
0
 def test_setup_timeout(self, mock_req):
     """Test setup when connection timeout occurs."""
     with raises(PlatformNotReady):
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         }, self.add_devices, None)
     assert len(self.DEVICES) == 0
Пример #5
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     with pytest.raises(MissingSchema):
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'localhost',
             'method': 'GET'
         }, None)
Пример #6
0
 def test_setup_timeout(self, mock_req):
     """Test setup when connection timeout occurs."""
     self.assertFalse(
         rest.setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         },
                             lambda devices, update=True: None))
Пример #7
0
 def test_setup_timeout(self, mock_req):
     """Test setup when connection timeout occurs."""
     self.assertFalse(rest.setup_platform(self.hass, {
         'platform': 'rest',
         'resource': 'http://localhost',
     }, lambda devices, update=True: None))