Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestSmhi(unittest.TestCase):
- """Test the Dark Sky weather component."""
- def setUp(self):
- """Set up things to be run when tests are started."""
- self.hass = get_test_home_assistant()
- def tearDown(self):
- """Stop down everything that was started."""
- self.hass.stop()
- @requests_mock.Mocker()
- def test_setup(self, mock_req):
- """Test for successfully setting up the forecast.io platform."""
- uri = smhi.smhi_lib.APIURL_TEMPLATE.format(TEST_CONFIG['latitude'],
- TEST_CONFIG['longitude'])
- _LOGGER.error(uri)
- mock_req.get(uri,
- text=load_fixture('smhi.json'))
- entry = MockConfigEntry(domain='smhi', data=TEST_CONFIG)
- entry.add_to_hass(self.hass)
- self.assertTrue(setup_component(self.hass, WEATHER_DOMAIN, {
- 'weather': {
- 'name': 'test',
- 'platform': 'smhi',
- }
- }))
- self.hass.block_till_done()
- state = self.hass.states.get('weather.smhi_test')
- self.assertEqual(state.state, 'sunny')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement