8000 0.106.2 by balloob · Pull Request #32327 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

0.106.2 #32327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 28, 2020
Merged

0.106.2 #32327

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/integrations/frontend",
"requirements": [
"home-assistant-frontend==20200220.4"
"home-assistant-frontend==20200220.5"
],
"dependencies": [
"api",
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/lovelace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ async def async_load(self, force):

async def async_save(self, config):
"""Save config."""
if self._hass.config.safe_mode:
raise HomeAssistantError("Deleting not supported in safe mode")

if self._data is None:
await self._load()
self._data["config"] = config
Expand All @@ -112,6 +115,9 @@ async def async_save(self, config):

async def async_delete(self):
"""Delete config."""
if self._hass.config.safe_mode:
raise HomeAssistantError("Deleting not supported in safe mode")

await self.async_save(None)

async def _load(self):
Expand Down
24 changes: 13 additions & 11 deletions homeassistant/components/rest/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,19 @@ def update(self):
self.rest.update()
value = self.rest.data
_LOGGER.debug("Data fetched from resource: %s", value)
content_type = self.rest.headers.get("content-type")

if content_type and content_type.startswith("text/xml"):
try:
value = json.dumps(xmltodict.parse(value))
_LOGGER.debug("JSON converted from XML: %s", value)
except ExpatError:
_LOGGER.warning(
"REST xml result could not be parsed and converted to JSON."
)
_LOGGER.debug("Erroneous XML: %s", value)
if self.rest.headers is not None:
# If the http request failed, headers will be None
content_type = self.rest.headers.get("content-type")

if content_type and content_type.startswith("text/xml"):
try:
value = json.dumps(xmltodict.parse(value))
_LOGGER.debug("JSON converted from XML: %s", value)
except ExpatError:
_LOGGER.warning(
"REST xml result could not be parsed and converted to JSON."
)
_LOGGER.debug("Erroneous XML: %s", value)

if self._json_attrs:
self._attributes = {}
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/unifi/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ def device_state_attributes(self):
@property
def should_poll(self):
"""No polling needed."""
return False
return True
2 changes: 1 addition & 1 deletion homeassistant/components/unifi/unifi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def device_info(self) -> dict:
@property
def should_poll(self) -> bool:
"""No polling needed."""
return False
return True
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 106
PATCH_VERSION = "1"
PATCH_VERSION = "2"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 0)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cryptography==2.8
defusedxml==0.6.0
distro==1.4.0
hass-nabucasa==0.31
home-assistant-frontend==20200220.4
home-assistant-frontend==20200220.5
importlib-metadata==1.5.0
jinja2>=2.10.3
netdisco==2.6.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ hole==0.5.0
holidays==0.10.1

# homeassistant.components.frontend
home-assistant-frontend==20200220.4
home-assistant-frontend==20200220.5

# homeassistant.components.zwave
homeassistant-pyozw==0.1.8
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ hole==0.5.0
holidays==0.10.1

# homeassistant.components.frontend
home-assistant-frontend==20200220.4
home-assistant-frontend==20200220.5

# homeassistant.components.zwave
homeassistant-pyozw==0.1.8
Expand Down
10 changes: 10 additions & 0 deletions tests/components/lovelace/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ async def test_lovelace_from_storage(hass, hass_ws_client, hass_storage):
assert not response["success"]
assert response["error"]["code"] == "config_not_found"

await client.send_json(
{"id": 9, "type": "lovelace/config/save", "config": {"yo": "hello"}}
)
response = await client.receive_json()
assert not response["success"]

await client.send_json({"id": 10, "type": "lovelace/config/delete"})
response = await client.receive_json()
assert not response["success"]


async def test_lovelace_from_storage_save_before_load(
hass, hass_ws_client, hass_storage
Expand Down
29 changes: 29 additions & 0 deletions tests/components/rest/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,35 @@ def test_update_with_xml_convert_bad_xml(self, mock_logger):
assert mock_logger.warning.called
assert mock_logger.debug.called

@patch("homeassistant.components.rest.sensor._LOGGER")
def test_update_with_failed_get(self, mock_logger):
"""Test attributes get extracted from a XML result with bad xml."""
value_template = template("{{ value_json.toplevel.master_value }}")
value_template.hass = self.hass

self.rest.update = Mock(
"rest.RestData.update", side_effect=self.update_side_effect(None, None),
)
self.sensor = rest.RestSensor(
self.hass,
self.rest,
self.name,
self.unit_of_measurement,
self.device_class,
value_template,
["key"],
self.force_update,
self.resource_template,
self.json_attrs_path,
)

self.sensor.update()
assert {} == self.sensor.device_state_attributes
assert mock_logger.warning.called
assert mock_logger.debug.called
assert self.sensor.state is None
assert self.sensor.available is False


class TestRestData(unittest.TestCase):
"""Tests for RestData."""
Expand Down
0