Accept login from approved ips without password (#3427)

This commit is contained in:
Daniel Høyer Iversen authored and Paulus Schoutsen committed 2016-09-18 10:20:19 -07:00
1 parent 2c43d6718b
commit 11c07440fe
3 files changed
+32 -4

No files matched your search

+18
View File
@@ -72,6 +72,15 @@ class TestHttp:
assert req.status_code == 401
def test_access_denied_with_ip_no_in_approved_ips(self, caplog):
"""Test access deniend with ip not in approved ip."""
hass.wsgi.approved_ips = ['134.4.56.1']
req = requests.get(_url(const.URL_API),
params={'api_password': ''})
assert req.status_code == 401
def test_access_with_password_in_header(self, caplog):
"""Test access with password in URL."""
# Hide logging from requests package that we use to test logging
@@ -112,6 +121,15 @@ class TestHttp:
# assert const.URL_API in logs
assert API_PASSWORD not in logs
def test_access_with_ip_in_approved_ips(self, caplog):
"""Test access with approved ip."""
hass.wsgi.approved_ips = ['127.0.0.1', '134.4.56.1']
req = requests.get(_url(const.URL_API),
params={'api_password': ''})
assert req.status_code == 200
def test_cors_allowed_with_password_in_url(self):
"""Test cross origin resource sharing with password in url."""
req = requests.get(_url(const.URL_API),