-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maint: Add support for migration from o365 integration
- Loading branch information
1 parent
12663df
commit f01add8
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Test migration""" | ||
|
||
import pytest | ||
from homeassistant import config_entries | ||
from homeassistant.core import HomeAssistant | ||
from requests_mock import Mocker | ||
|
||
from .helpers.utils import mock_token | ||
from .integration.const_integration import ( | ||
BASE_TOKEN_PERMS, | ||
DOMAIN, | ||
MIGRATION_CONFIG_ENTRY, | ||
) | ||
from .integration.helpers_integration.mocks import MS365MOCKS | ||
|
||
|
||
async def test_default_flow( | ||
tmp_path, | ||
hass: HomeAssistant, | ||
requests_mock: Mocker, | ||
caplog: pytest.LogCaptureFixture, | ||
) -> None: | ||
"""Test the default config_flow.""" | ||
mock_token(requests_mock, BASE_TOKEN_PERMS) | ||
MS365MOCKS.standard_mocks(requests_mock) | ||
|
||
await hass.config_entries.flow.async_init( | ||
DOMAIN, | ||
context={"source": config_entries.SOURCE_IMPORT}, | ||
data=MIGRATION_CONFIG_ENTRY, | ||
) | ||
assert ( | ||
f"Could not locate token at {tmp_path}/storage/tokens/{DOMAIN}_test.token" | ||
in caplog.text | ||
) | ||
await hass.config_entries.flow.async_init( | ||
DOMAIN, | ||
context={"source": config_entries.SOURCE_IMPORT}, | ||
data=MIGRATION_CONFIG_ENTRY, | ||
) |