mirror of
https://github.com/home-assistant/core.git
synced 2025-08-13 15:30:03 +00:00
.circleci
.github
docs
homeassistant
script
tests
auth
components
air_quality
alarm_control_panel
alert
alexa
ambient_station
api
api_streams
apns
arlo
asuswrt
aurora
auth
automatic
automation
awair
aws
axis
bayesian
binary_sensor
blackbird
bom
broadlink
caldav
calendar
camera
canary
cast
climate
cloud
coinmarketcap
command_line
config
__init__.py
test_area_registry.py
test_auth.py
test_auth_provider_homeassistant.py
test_automation.py
test_config_entries.py
test_core.py
test_customize.py
test_device_registry.py
test_entity_registry.py
test_group.py
test_init.py
test_zwave.py
configurator
conversation
counter
cover
daikin
darksky
datadog
deconz
default_config
demo
device_sun_light_trigger
device_tracker
dialogflow
directv
discovery
dsmr
dte_energy_bridge
duckdns
dyson
ecobee
ee_brightbox
efergy
emulated_hue
emulated_roku
esphome
everlights
facebook
facebox
fail2ban
fan
feedreader
ffmpeg
fido
file
filesize
filter
flux
folder
folder_watcher
foobot
freedns
fritzbox
frontend
generic
generic_thermostat
geo_json_events
geo_location
geo_rss_events
geofency
google
google_assistant
google_domains
google_pubsub
google_translate
google_wifi
gpslogger
graphite
group
hangouts
hassio
hddtemp
heos
history
history_graph
history_stats
homeassistant
homekit
homekit_controller
homematic
homematicip_cloud
honeywell
html5
http
huawei_lte
hue
hydroquebec
ifttt
ign_sismologia
image_processing
imap_email_content
influxdb
input_boolean
input_datetime
input_number
input_select
input_text
integration
intent_script
ios
ipma
islamic_prayer_times
jewish_calendar
kira
light
litejet
local_file
locative
lock
logbook
logentries
logger
logi_circle
london_air
lovelace
luftdaten
mailbox
mailgun
manual
manual_mqtt
marytts
media_player
melissa
meraki
mfi
mhz19
microsoft_face
microsoft_face_detect
microsoft_face_identify
min_max
mobile_app
mochad
mold_indicator
monoprice
moon
mqtt
mqtt_eventstream
mqtt_json
mqtt_room
mqtt_statestream
mythicbeastsdns
namecheapdns
ness_alarm
nest
no_ip
notify
nsw_fuel_station
nsw_rural_fire_service_feed
nuheat
nx584
onboarding
openalpr_cloud
openalpr_local
openhardwaremonitor
openuv
owntracks
panel_custom
panel_iframe
persistent_notification
person
pilight
plant
point
prometheus
proximity
ps4
push
pushbullet
python_script
qwikswitch
radarr
rainmachine
random
recorder
reddit
remember_the_milk
remote
rest
rest_command
rflink
rfxtrx
ring
rmvtransport
rss_feed_template
samsungtv
scene
script
season
sensor
shell_command
shopping_list
sigfox
simplisafe
simulated
sleepiq
smartthings
smhi
smtp
snips
sonarr
sonos
soundtouch
spaceapi
spc
splunk
sql
srp_energy
startca
statistics
statsd
stream
sun
switch
switcher_kis
system_health
system_log
tcp
teksavvy
tellduslive
template
threshold
time_date
timer
tod
tomato
toon
tplink
tradfri
transport_nsw
trend
tts
twilio
uk_transport
unifi
unifi_direct
universal
upc_connect
updater
upnp
uptime
usgs_earthquakes_feed
utility_meter
uvc
vacuum
verisure
version
voicerss
vultr
wake_on_lan
water_heater
weather
webhook
weblink
webostv
websocket_api
workday
worldclock
wsdot
wunderground
xiaomi
xiaomi_miio
yamaha
yandextts
yessssms
yr
yweather
zha
zone
zwave
__init__.py
conftest.py
fixtures
helpers
mock
resources
scripts
test_util
testing_config
util
__init__.py
common.py
conftest.py
test_bootstrap.py
test_config.py
test_config_entries.py
test_core.py
test_data_entry_flow.py
test_loader.py
test_main.py
test_requirements.py
test_setup.py
virtualization
.codecov.yml
.coveragerc
.dockerignore
.gitattributes
.gitignore
.hound.yml
.ignore
.readthedocs.yml
CLA.md
CODEOWNERS
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile
LICENSE.md
MANIFEST.in
README.rst
mypy.ini
mypyrc
pylintrc
requirements_all.txt
requirements_docs.txt
requirements_test.txt
requirements_test_all.txt
setup.cfg
setup.py
tox.ini
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""Test config init."""
|
|
import asyncio
|
|
from unittest.mock import patch
|
|
|
|
from homeassistant.const import EVENT_COMPONENT_LOADED
|
|
from homeassistant.setup import async_setup_component, ATTR_COMPONENT
|
|
from homeassistant.components import config
|
|
|
|
from tests.common import mock_coro, mock_component
|
|
|
|
|
|
@asyncio.coroutine
|
|
def test_config_setup(hass, loop):
|
|
"""Test it sets up hassbian."""
|
|
yield from async_setup_component(hass, 'config', {})
|
|
assert 'config' in hass.config.components
|
|
|
|
|
|
@asyncio.coroutine
|
|
def test_load_on_demand_already_loaded(hass, aiohttp_client):
|
|
"""Test getting suites."""
|
|
mock_component(hass, 'zwave')
|
|
|
|
with patch.object(config, 'SECTIONS', []), \
|
|
patch.object(config, 'ON_DEMAND', ['zwave']), \
|
|
patch('homeassistant.components.config.zwave.async_setup') as stp:
|
|
stp.return_value = mock_coro(True)
|
|
|
|
yield from async_setup_component(hass, 'config', {})
|
|
|
|
yield from hass.async_block_till_done()
|
|
assert stp.called
|
|
|
|
|
|
@asyncio.coroutine
|
|
def test_load_on_demand_on_load(hass, aiohttp_client):
|
|
"""Test getting suites."""
|
|
with patch.object(config, 'SECTIONS', []), \
|
|
patch.object(config, 'ON_DEMAND', ['zwave']):
|
|
yield from async_setup_component(hass, 'config', {})
|
|
|
|
assert 'config.zwave' not in hass.config.components
|
|
|
|
with patch('homeassistant.components.config.zwave.async_setup') as stp:
|
|
stp.return_value = mock_coro(True)
|
|
hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: 'zwave'})
|
|
yield from hass.async_block_till_done()
|
|
|
|
assert stp.called
|