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
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)
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, )
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
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)
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, ) assert len(self.DEVICES) == 0