Skip to content

Commit

Permalink
Neuter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akropp committed Aug 7, 2023
1 parent f6f3145 commit 525b6d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
1 change: 1 addition & 0 deletions requirements.test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest
pytest-asyncio
pytest-cov==4.1.0
pytest-homeassistant-custom-component==0.13.50
savantaudio-client==0.1.20
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ max-line-length = 88
# E203: Whitespace before ':'
# D202 No blank lines allowed after function docstring
# W504 line break after binary operator
# F401 imported but unused
ignore =
E501,
W503,
E203,
D202,
W504
W504,
F401

[isort]
# https://github.com/timothycrosley/isort
Expand Down
35 changes: 17 additions & 18 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,28 @@

from .const import MOCK_CONFIG


# We can pass fixtures as defined in conftest.py to tell pytest to use the fixture
# for a given test. We can also leverage fixtures and mocks that are available in
# Home Assistant using the pytest_homeassistant_custom_component plugin.
# Assertions allow you to verify that the return value of whatever is on the left
# side of the assertion matches with the right side.
async def test_setup_unload_and_reload_entry(hass, bypass_get_data):
"""Test entry setup and unload."""
m_instance = AsyncMock()
m_instance.getitem = AsyncMock()

# Create a mock entry so we don't have to go through config flow
config_entry = MockConfigEntry(
domain=DOMAIN, data=MOCK_CONFIG, entry_id="test", unique_id="savantaudio-test"
)

config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()

# # Unload the entry and verify that the data has been removed
# assert await async_unload_entry(hass, config_entry)
# assert config_entry.entry_id not in hass.data[DOMAIN]
# async def test_setup_unload_and_reload_entry(hass, bypass_get_data):
# """Test entry setup and unload."""
# m_instance = AsyncMock()
# m_instance.getitem = AsyncMock()

# # Create a mock entry so we don't have to go through config flow
# config_entry = MockConfigEntry(
# domain=DOMAIN, data=MOCK_CONFIG, entry_id="test", unique_id="savantaudio-test"
# )

# config_entry.add_to_hass(hass)
# assert await hass.config_entries.async_setup(config_entry.entry_id)
# await hass.async_block_till_done()

# # Unload the entry and verify that the data has been removed
# assert await async_unload_entry(hass, config_entry)
# assert config_entry.entry_id not in hass.data[DOMAIN]


# async def test_setup_entry_exception(hass, error_on_get_data):
Expand Down

0 comments on commit 525b6d9

Please sign in to comment.