Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00

38 lines
1.1 KiB
Python

"""Tests for Brother Printer integration."""
import json
from unittest.mock import patch
from homeassistant.components.brother.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_TYPE
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, load_fixture
async def init_integration(
hass: HomeAssistant, skip_setup: bool = False
) -> MockConfigEntry:
"""Set up the Brother integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
title="HL-L2340DW 0123456789",
unique_id="0123456789",
data={CONF_HOST: "localhost", CONF_TYPE: "laser"},
)
entry.add_to_hass(hass)
if not skip_setup:
with (
patch("brother.Brother.initialize"),
patch(
"brother.Brother._get_data",
return_value=json.loads(load_fixture("printer_data.json", "brother")),
),
):
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
return entry