Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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))
Esempio n. 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))