예제 #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))