|
9 | 9 | ) |
10 | 10 | import pytest |
11 | 11 |
|
12 | | -from homeassistant.components.alexa_devices.const import CONF_LOGIN_DATA, DOMAIN |
| 12 | +from homeassistant.components.alexa_devices.const import ( |
| 13 | + CONF_LOGIN_DATA, |
| 14 | + CONF_SITE, |
| 15 | + DOMAIN, |
| 16 | +) |
13 | 17 | from homeassistant.config_entries import SOURCE_USER |
14 | 18 | from homeassistant.const import CONF_CODE, CONF_PASSWORD, CONF_USERNAME |
15 | 19 | from homeassistant.core import HomeAssistant |
@@ -48,6 +52,7 @@ async def test_full_flow( |
48 | 52 | CONF_PASSWORD: TEST_PASSWORD, |
49 | 53 | CONF_LOGIN_DATA: { |
50 | 54 | "customer_info": {"user_id": TEST_USERNAME}, |
| 55 | + CONF_SITE: "https://www.amazon.com", |
51 | 56 | }, |
52 | 57 | } |
53 | 58 | assert result["result"].unique_id == TEST_USERNAME |
@@ -158,6 +163,16 @@ async def test_reauth_successful( |
158 | 163 | assert result["type"] is FlowResultType.ABORT |
159 | 164 | assert result["reason"] == "reauth_successful" |
160 | 165 |
|
| 166 | + assert mock_config_entry.data == { |
| 167 | + CONF_CODE: "000000", |
| 168 | + CONF_USERNAME: TEST_USERNAME, |
| 169 | + CONF_PASSWORD: "other_fake_password", |
| 170 | + CONF_LOGIN_DATA: { |
| 171 | + "customer_info": {"user_id": TEST_USERNAME}, |
| 172 | + CONF_SITE: "https://www.amazon.com", |
| 173 | + }, |
| 174 | + } |
| 175 | + |
161 | 176 |
|
162 | 177 | @pytest.mark.parametrize( |
163 | 178 | ("side_effect", "error"), |
@@ -206,8 +221,15 @@ async def test_reauth_not_successful( |
206 | 221 |
|
207 | 222 | assert result["type"] is FlowResultType.ABORT |
208 | 223 | assert result["reason"] == "reauth_successful" |
209 | | - assert mock_config_entry.data[CONF_PASSWORD] == "fake_password" |
210 | | - assert mock_config_entry.data[CONF_CODE] == "111111" |
| 224 | + assert mock_config_entry.data == { |
| 225 | + CONF_CODE: "111111", |
| 226 | + CONF_USERNAME: TEST_USERNAME, |
| 227 | + CONF_PASSWORD: "fake_password", |
| 228 | + CONF_LOGIN_DATA: { |
| 229 | + "customer_info": {"user_id": TEST_USERNAME}, |
| 230 | + CONF_SITE: "https://www.amazon.com", |
| 231 | + }, |
| 232 | + } |
211 | 233 |
|
212 | 234 |
|
213 | 235 | async def test_reconfigure_successful( |
@@ -240,7 +262,14 @@ async def test_reconfigure_successful( |
240 | 262 | assert reconfigure_result["reason"] == "reconfigure_successful" |
241 | 263 |
|
242 | 264 | # changed entry |
243 | | - assert mock_config_entry.data[CONF_PASSWORD] == new_password |
| 265 | + assert mock_config_entry.data == { |
| 266 | + CONF_USERNAME: TEST_USERNAME, |
| 267 | + CONF_PASSWORD: new_password, |
| 268 | + CONF_LOGIN_DATA: { |
| 269 | + "customer_info": {"user_id": TEST_USERNAME}, |
| 270 | + CONF_SITE: "https://www.amazon.com", |
| 271 | + }, |
| 272 | + } |
244 | 273 |
|
245 | 274 |
|
246 | 275 | @pytest.mark.parametrize( |
@@ -297,5 +326,6 @@ async def test_reconfigure_fails( |
297 | 326 | CONF_PASSWORD: TEST_PASSWORD, |
298 | 327 | CONF_LOGIN_DATA: { |
299 | 328 | "customer_info": {"user_id": TEST_USERNAME}, |
| 329 | + CONF_SITE: "https://www.amazon.com", |
300 | 330 | }, |
301 | 331 | } |
0 commit comments