mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 10:44:13 +01:00
Add testing for setting port from env var and fix pylint
This commit is contained in:
parent
59b410980e
commit
c2174a6408
1 changed files with 4 additions and 3 deletions
|
@ -35,14 +35,14 @@ class DashboardTestHelper:
|
|||
return result
|
||||
|
||||
|
||||
@pytest_asyncio.fixture()
|
||||
async def dashboard() -> DashboardTestHelper:
|
||||
@pytest_asyncio.fixture(name="dashboard")
|
||||
async def fixture_dashboard() -> DashboardTestHelper:
|
||||
sock, port = bind_unused_port()
|
||||
args = Mock(
|
||||
ha_addon=True,
|
||||
configuration=get_fixture_path("conf"),
|
||||
port=port,
|
||||
)
|
||||
os.environ["ESPHOME_DASHBOARD_PORT"] = str(port)
|
||||
DASHBOARD.settings.parse_args(args)
|
||||
app = web_server.make_app()
|
||||
http_server = HTTPServer(app)
|
||||
|
@ -52,6 +52,7 @@ async def dashboard() -> DashboardTestHelper:
|
|||
assert DASHBOARD.settings.using_password is False
|
||||
assert DASHBOARD.settings.on_ha_addon is True
|
||||
assert DASHBOARD.settings.using_auth is False
|
||||
assert DASHBOARD.settings.port is port
|
||||
task = asyncio.create_task(DASHBOARD.async_run())
|
||||
client = AsyncHTTPClient()
|
||||
io_loop = IOLoop(make_current=False)
|
||||
|
|
Loading…
Reference in a new issue