Esempio n. 1
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'localhost'
         }, None), self.hass.loop).result()
 def test_setup_missing_config(self):
     """Test setup with configuration missing required entries."""
     assert not asyncio.run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {CONF_PLATFORM: rest.DOMAIN},
                                   None),
         self.hass.loop,
     ).result()
Esempio n. 3
0
 def test_setup_missing_config(self):
     """Test setup with configuration missing required entries."""
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             'platform': 'rest'
         }, None),
         self.hass.loop
     ).result()
Esempio n. 4
0
 def test_setup_timeout(self, aioclient_mock):
     """Test setup when connection timeout occurs."""
     aioclient_mock.get('http://localhost', exc=asyncio.TimeoutError())
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         }, None), self.hass.loop).result()
Esempio n. 5
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'localhost'
         }, None),
         self.hass.loop
     ).result()
Esempio n. 6
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     assert not asyncio.run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             "platform": "rest",
             "resource": "localhost"
         }, None),
         self.hass.loop,
     ).result()
Esempio n. 7
0
 def test_setup_timeout(self, aioclient_mock):
     """Test setup when connection timeout occurs."""
     aioclient_mock.get('http://localhost', exc=asyncio.TimeoutError())
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             'platform': 'rest',
             'resource': 'http://localhost',
         }, None),
         self.hass.loop
     ).result()
Esempio n. 8
0
 def test_setup_timeout(self, aioclient_mock):
     """Test setup when connection timeout occurs."""
     aioclient_mock.get("http://localhost", exc=asyncio.TimeoutError())
     assert not asyncio.run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             "platform": "rest",
             "resource": "http://localhost"
         }, None),
         self.hass.loop,
     ).result()
Esempio n. 9
0
 def test_setup_failed_connect(self, aioclient_mock):
     """Test setup when connection error occurs."""
     aioclient_mock.get("http://localhost", exc=aiohttp.ClientError)
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {
             "platform": "rest",
             "resource": "http://localhost"
         }, None),
         self.hass.loop,
     ).result()
Esempio n. 10
0
 def test_setup_missing_schema(self):
     """Test setup with resource missing schema."""
     assert not asyncio.run_coroutine_threadsafe(
         rest.async_setup_platform(
             self.hass,
             {
                 CONF_PLATFORM: rest.DOMAIN,
                 CONF_RESOURCE: "localhost"
             },
             None,
         ),
         self.hass.loop,
     ).result()
Esempio n. 11
0
 def test_setup_timeout(self, aioclient_mock):
     """Test setup when connection timeout occurs."""
     aioclient_mock.get("http://localhost", exc=asyncio.TimeoutError())
     assert not asyncio.run_coroutine_threadsafe(
         rest.async_setup_platform(
             self.hass,
             {
                 CONF_PLATFORM: rest.DOMAIN,
                 CONF_RESOURCE: "http://localhost"
             },
             None,
         ),
         self.hass.loop,
     ).result()
Esempio n. 12
0
 def test_setup_missing_config(self):
     """Test setup with configuration missing required entries."""
     assert not run_coroutine_threadsafe(
         rest.async_setup_platform(self.hass, {"platform": "rest"}, None),
         self.hass.loop,
     ).result()