Ignore smartthings storage on fresh install (#98418)

* Ignore smartthings storage on fresh install

* Also unload existing things when going for clean install

* Rename param

* Fix tests
This commit is contained in:
Paulus Schoutsen 2023-08-14 22:39:05 -04:00 committed by GitHub
parent e3438baf49
commit ced4af1e22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View file

@ -187,6 +187,7 @@ async def test_entry_created_existing_app_new_oauth_client(
smartthings_mock.apps.return_value = [app]
smartthings_mock.generate_app_oauth.return_value = app_oauth_client
smartthings_mock.locations.return_value = [location]
smartthings_mock.create_app = AsyncMock(return_value=(app, app_oauth_client))
request = Mock()
request.installed_app_id = installed_app_id
request.auth_token = token
@ -366,7 +367,7 @@ async def test_entry_created_with_cloudhook(
"async_create_cloudhook",
AsyncMock(return_value="http://cloud.test"),
) as mock_create_cloudhook:
await smartapp.setup_smartapp_endpoint(hass)
await smartapp.setup_smartapp_endpoint(hass, True)
# Webhook confirmation shown
result = await hass.config_entries.flow.async_init(
@ -377,7 +378,8 @@ async def test_entry_created_with_cloudhook(
assert result["description_placeholders"][
"webhook_url"
] == smartapp.get_webhook_url(hass)
assert mock_create_cloudhook.call_count == 1
# One is done by app fixture, one done by new config entry
assert mock_create_cloudhook.call_count == 2
# Advance to PAT screen
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})