mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-16 13:46:31 +00:00
Don't follow requests itself (#1106)
* Don't follow requests itself * Fix black lint
This commit is contained in:
parent
b94df76731
commit
611f6f2829
@ -50,7 +50,7 @@ jobs:
|
|||||||
versionSpec: '3.7'
|
versionSpec: '3.7'
|
||||||
- script: pip install black
|
- script: pip install black
|
||||||
displayName: 'Install black'
|
displayName: 'Install black'
|
||||||
- script: black --check hassio
|
- script: black --check hassio tests
|
||||||
displayName: 'Run Black'
|
displayName: 'Run Black'
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,7 +158,12 @@ class APIIngress(CoreSysAttributes):
|
|||||||
source_header = _init_header(request, addon)
|
source_header = _init_header(request, addon)
|
||||||
|
|
||||||
async with self.sys_websession.request(
|
async with self.sys_websession.request(
|
||||||
request.method, url, headers=source_header, params=request.query, data=data
|
request.method,
|
||||||
|
url,
|
||||||
|
headers=source_header,
|
||||||
|
params=request.query,
|
||||||
|
allow_redirects=False,
|
||||||
|
data=data,
|
||||||
) as result:
|
) as result:
|
||||||
headers = _response_header(result)
|
headers = _response_header(result)
|
||||||
|
|
||||||
|
55
setup.py
55
setup.py
@ -3,33 +3,40 @@ from setuptools import setup
|
|||||||
from hassio.const import HASSIO_VERSION
|
from hassio.const import HASSIO_VERSION
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='HassIO',
|
name="HassIO",
|
||||||
version=HASSIO_VERSION,
|
version=HASSIO_VERSION,
|
||||||
license='BSD License',
|
license="BSD License",
|
||||||
author='The Home Assistant Authors',
|
author="The Home Assistant Authors",
|
||||||
author_email='hello@home-assistant.io',
|
author_email="hello@home-assistant.io",
|
||||||
url='https://home-assistant.io/',
|
url="https://home-assistant.io/",
|
||||||
description=('Open-source private cloud os for Home-Assistant'
|
description=("Open-source private cloud os for Home-Assistant" " based on HassOS"),
|
||||||
' based on HassOS'),
|
long_description=(
|
||||||
long_description=('A maintainless private cloud operator system that'
|
"A maintainless private cloud operator system that"
|
||||||
'setup a Home-Assistant instance. Based on HassOS'),
|
"setup a Home-Assistant instance. Based on HassOS"
|
||||||
|
),
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Intended Audience :: End Users/Desktop',
|
"Intended Audience :: End Users/Desktop",
|
||||||
'Intended Audience :: Developers',
|
"Intended Audience :: Developers",
|
||||||
'License :: OSI Approved :: Apache Software License',
|
"License :: OSI Approved :: Apache Software License",
|
||||||
'Operating System :: OS Independent',
|
"Operating System :: OS Independent",
|
||||||
'Topic :: Home Automation'
|
"Topic :: Home Automation"
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
'Topic :: Scientific/Engineering :: Atmospheric Science',
|
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
||||||
'Development Status :: 5 - Production/Stable',
|
"Development Status :: 5 - Production/Stable",
|
||||||
'Intended Audience :: Developers',
|
"Intended Audience :: Developers",
|
||||||
'Programming Language :: Python :: 3.6',
|
"Programming Language :: Python :: 3.6",
|
||||||
],
|
],
|
||||||
keywords=['docker', 'home-assistant', 'api'],
|
keywords=["docker", "home-assistant", "api"],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
platforms='any',
|
platforms="any",
|
||||||
packages=[
|
packages=[
|
||||||
'hassio', 'hassio.docker', 'hassio.addons', 'hassio.api', 'hassio.misc',
|
"hassio",
|
||||||
'hassio.utils', 'hassio.snapshots'
|
"hassio.docker",
|
||||||
|
"hassio.addons",
|
||||||
|
"hassio.api",
|
||||||
|
"hassio.misc",
|
||||||
|
"hassio.utils",
|
||||||
|
"hassio.snapshots",
|
||||||
],
|
],
|
||||||
include_package_data=True)
|
include_package_data=True,
|
||||||
|
)
|
||||||
|
@ -14,34 +14,35 @@ def test_basic_config():
|
|||||||
|
|
||||||
valid_config = vd.SCHEMA_ADDON_CONFIG(config)
|
valid_config = vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
assert valid_config['name'] == "Test Add-on"
|
assert valid_config["name"] == "Test Add-on"
|
||||||
assert valid_config['image'] == "test/{arch}-my-custom-addon"
|
assert valid_config["image"] == "test/{arch}-my-custom-addon"
|
||||||
|
|
||||||
# Check defaults
|
# Check defaults
|
||||||
assert not valid_config['host_network']
|
assert not valid_config["host_network"]
|
||||||
assert not valid_config['host_ipc']
|
assert not valid_config["host_ipc"]
|
||||||
assert not valid_config['host_dbus']
|
assert not valid_config["host_dbus"]
|
||||||
assert not valid_config['host_pid']
|
assert not valid_config["host_pid"]
|
||||||
|
|
||||||
assert not valid_config['hassio_api']
|
assert not valid_config["hassio_api"]
|
||||||
assert not valid_config['homeassistant_api']
|
assert not valid_config["homeassistant_api"]
|
||||||
assert not valid_config['docker_api']
|
assert not valid_config["docker_api"]
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_repository():
|
def test_invalid_repository():
|
||||||
"""Validate basic config with invalid repositories."""
|
"""Validate basic config with invalid repositories."""
|
||||||
config = load_json_fixture("basic-addon-config.json")
|
config = load_json_fixture("basic-addon-config.json")
|
||||||
|
|
||||||
config['image'] = "something"
|
config["image"] = "something"
|
||||||
with pytest.raises(vol.Invalid):
|
with pytest.raises(vol.Invalid):
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
config['image'] = "homeassistant/no-valid-repo:no-tag-allow"
|
config["image"] = "homeassistant/no-valid-repo:no-tag-allow"
|
||||||
with pytest.raises(vol.Invalid):
|
with pytest.raises(vol.Invalid):
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
config[
|
config[
|
||||||
'image'] = "registry.gitlab.com/company/add-ons/test-example/text-example:no-tag-allow"
|
"image"
|
||||||
|
] = "registry.gitlab.com/company/add-ons/test-example/text-example:no-tag-allow"
|
||||||
with pytest.raises(vol.Invalid):
|
with pytest.raises(vol.Invalid):
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
@ -51,16 +52,16 @@ def test_valid_repository():
|
|||||||
config = load_json_fixture("basic-addon-config.json")
|
config = load_json_fixture("basic-addon-config.json")
|
||||||
|
|
||||||
custom_registry = "registry.gitlab.com/company/add-ons/core/test-example"
|
custom_registry = "registry.gitlab.com/company/add-ons/core/test-example"
|
||||||
config['image'] = custom_registry
|
config["image"] = custom_registry
|
||||||
valid_config = vd.SCHEMA_ADDON_CONFIG(config)
|
valid_config = vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
assert valid_config['image'] == custom_registry
|
assert valid_config["image"] == custom_registry
|
||||||
|
|
||||||
|
|
||||||
def test_valid_map():
|
def test_valid_map():
|
||||||
"""Validate basic config with different valid maps"""
|
"""Validate basic config with different valid maps"""
|
||||||
config = load_json_fixture("basic-addon-config.json")
|
config = load_json_fixture("basic-addon-config.json")
|
||||||
|
|
||||||
config['map'] = ['backup:rw', 'ssl:ro', 'config']
|
config["map"] = ["backup:rw", "ssl:ro", "config"]
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user