1
0
mirror of https://github.com/home-assistant/core.git synced 2025-08-13 15:30:03 +00:00
Files
.github
docs
homeassistant
script
tests
components
alarm_control_panel
automation
binary_sensor
calendar
camera
climate
config
cover
device_tracker
emulated_hue
fan
http
image_processing
light
lock
media_player
mqtt
notify
recorder
remote
scene
sensor
__init__.py
test_api_streams.py
test_command_line.py
test_darksky.py
test_dsmr.py
test_dyson.py
test_efergy.py
test_file.py
test_google_wifi.py
test_history_stats.py
test_imap_email_content.py
test_kira.py
test_london_underground.py
test_mfi.py
test_mhz19.py
test_min_max.py
test_moldindicator.py
test_moon.py
test_mqtt.py
test_mqtt_room.py
test_openhardwaremonitor.py
test_pilight.py
test_radarr.py
test_random.py
test_rest.py
test_rflink.py
test_rfxtrx.py
test_ring.py
test_sleepiq.py
test_sonarr.py
test_statistics.py
test_tcp.py
test_template.py
test_time_date.py
test_uk_transport.py
test_worldclock.py
test_wsdot.py
test_wunderground.py
test_yahoo_finance.py
test_yr.py
test_zwave.py
switch
tts
weather
zwave
__init__.py
test_alert.py
test_alexa.py
test_api.py
test_apiai.py
test_configurator.py
test_conversation.py
test_datadog.py
test_demo.py
test_device_sun_light_trigger.py
test_discovery.py
test_dyson.py
test_ffmpeg.py
test_frontend.py
test_google.py
test_graphite.py
test_group.py
test_hassio.py
test_history.py
test_influxdb.py
test_init.py
test_input_boolean.py
test_input_select.py
test_input_slider.py
test_intent_script.py
test_introduction.py
test_kira.py
test_litejet.py
test_logbook.py
test_logentries.py
test_logger.py
test_microsoft_face.py
test_mqtt_eventstream.py
test_panel_custom.py
test_panel_iframe.py
test_persistent_notification.py
test_pilight.py
test_plant.py
test_prometheus.py
test_proximity.py
test_python_script.py
test_rest_command.py
test_rflink.py
test_rfxtrx.py
test_ring.py
test_rss_feed_template.py
test_script.py
test_shell_command.py
test_shopping_list.py
test_sleepiq.py
test_snips.py
test_spc.py
test_splunk.py
test_statsd.py
test_sun.py
test_updater.py
test_wake_on_lan.py
test_weblink.py
test_websocket_api.py
test_zone.py
fixtures
helpers
mock
resources
scripts
test_util
testing_config
util
__init__.py
common.py
conftest.py
test_bootstrap.py
test_config.py
test_core.py
test_loader.py
test_main.py
test_remote.py
test_setup.py
virtualization
.coveragerc
.dockerignore
.gitignore
.gitmodules
.hound.yml
.ignore
.travis.yml
CLA.md
CODEOWNERS
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile
LICENSE.md
MANIFEST.in
README.rst
pylintrc
requirements_all.txt
requirements_docs.txt
requirements_test.txt
requirements_test_all.txt
setup.cfg
setup.py
tox.ini
core/tests/components/sensor/test_random.py
Paulus Schoutsen 2650c73a89 Split bootstrap into bs + setup ()
* Split bootstrap into bs + setup

* Lint
2017-03-05 10:41:54 +01:00

37 lines
1.0 KiB
Python

"""The test for the random number sensor platform."""
import unittest
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant
class TestRandomSensor(unittest.TestCase):
"""Test the Random number sensor."""
def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop()
def test_random_sensor(self):
"""Test the Randowm number sensor."""
config = {
'sensor': {
'platform': 'random',
'name': 'test',
'minimum': 10,
'maximum': 20,
}
}
assert setup_component(self.hass, 'sensor', config)
state = self.hass.states.get('sensor.test')
self.assertLessEqual(int(state.state), config['sensor']['maximum'])
self.assertGreaterEqual(int(state.state), config['sensor']['minimum'])