2016-08-25 12:47:07 +00:00
|
|
|
"""Test fan component plaforms."""
|
2016-08-27 20:53:12 +00:00
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from homeassistant.components.fan import FanEntity
|
|
|
|
|
|
|
|
|
|
|
|
class BaseFan(FanEntity):
|
|
|
|
"""Implementation of the abstract FanEntity."""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
"""Initialize the fan."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class TestFanEntity(unittest.TestCase):
|
|
|
|
"""Test coverage for base fan entity class."""
|
|
|
|
|
|
|
|
def setUp(self):
|
2017-05-02 16:18:47 +00:00
|
|
|
"""Set up test data."""
|
2016-08-27 20:53:12 +00:00
|
|
|
self.fan = BaseFan()
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
"""Tear down unit test data."""
|
|
|
|
self.fan = None
|
|
|
|
|
|
|
|
def test_fanentity(self):
|
|
|
|
"""Test fan entity methods."""
|
|
|
|
self.assertIsNone(self.fan.state)
|
|
|
|
self.assertEqual(0, len(self.fan.speed_list))
|
|
|
|
self.assertEqual(0, self.fan.supported_features)
|
|
|
|
self.assertEqual({}, self.fan.state_attributes)
|
|
|
|
# Test set_speed not required
|
|
|
|
self.fan.set_speed()
|
|
|
|
self.fan.oscillate()
|
|
|
|
with self.assertRaises(NotImplementedError):
|
|
|
|
self.fan.turn_on()
|
|
|
|
with self.assertRaises(NotImplementedError):
|
|
|
|
self.fan.turn_off()
|