@@ -137,25 +137,25 @@ async def test_login_flow_validates_mfa(hass: HomeAssistant) -> None:
137137 provider = hass .auth .auth_providers [0 ]
138138
139139 result = await hass .auth .login_flow .async_init ((provider .type , provider .id ))
140- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
140+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
141141
142142 result = await hass .auth .login_flow .async_configure (
143143 result ["flow_id" ], {"username" : "incorrect-user" , "password" : "test-pass" }
144144 )
145- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
145+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
146146 assert result ["errors" ]["base" ] == "invalid_auth"
147147
148148 result = await hass .auth .login_flow .async_configure (
149149 result ["flow_id" ], {"username" : "test-user" , "password" : "incorrect-pass" }
150150 )
151- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
151+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
152152 assert result ["errors" ]["base" ] == "invalid_auth"
153153
154154 with patch ("pyotp.HOTP.at" , return_value = MOCK_CODE ):
155155 result = await hass .auth .login_flow .async_configure (
156156 result ["flow_id" ], {"username" : "test-user" , "password" : "test-pass" }
157157 )
158- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
158+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
159159 assert result ["step_id" ] == "mfa"
160160 assert result ["data_schema" ].schema .get ("code" ) is str
161161
@@ -173,7 +173,7 @@ async def test_login_flow_validates_mfa(hass: HomeAssistant) -> None:
173173 result = await hass .auth .login_flow .async_configure (
174174 result ["flow_id" ], {"code" : "invalid-code" }
175175 )
176- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
176+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
177177 assert result ["step_id" ] == "mfa"
178178 assert result ["errors" ]["base" ] == "invalid_code"
179179
@@ -191,29 +191,29 @@ async def test_login_flow_validates_mfa(hass: HomeAssistant) -> None:
191191 result = await hass .auth .login_flow .async_configure (
192192 result ["flow_id" ], {"code" : "invalid-code" }
193193 )
194- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
194+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
195195 assert result ["step_id" ] == "mfa"
196196 assert result ["errors" ]["base" ] == "invalid_code"
197197
198198 # after the 3rd failure, flow abort
199199 result = await hass .auth .login_flow .async_configure (
200200 result ["flow_id" ], {"code" : "invalid-code" }
201201 )
202- assert result ["type" ] == data_entry_flow .FlowResultType .ABORT
202+ assert result ["type" ] is data_entry_flow .FlowResultType .ABORT
203203 assert result ["reason" ] == "too_many_retry"
204204
205205 # wait service call finished
206206 await hass .async_block_till_done ()
207207
208208 # restart login
209209 result = await hass .auth .login_flow .async_init ((provider .type , provider .id ))
210- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
210+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
211211
212212 with patch ("pyotp.HOTP.at" , return_value = MOCK_CODE ):
213213 result = await hass .auth .login_flow .async_configure (
214214 result ["flow_id" ], {"username" : "test-user" , "password" : "test-pass" }
215215 )
216- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
216+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
217217 assert result ["step_id" ] == "mfa"
218218 assert result ["data_schema" ].schema .get ("code" ) is str
219219
@@ -231,7 +231,7 @@ async def test_login_flow_validates_mfa(hass: HomeAssistant) -> None:
231231 result = await hass .auth .login_flow .async_configure (
232232 result ["flow_id" ], {"code" : MOCK_CODE }
233233 )
234- assert result ["type" ] == data_entry_flow .FlowResultType .CREATE_ENTRY
234+ assert result ["type" ] is data_entry_flow .FlowResultType .CREATE_ENTRY
235235 assert result ["data" ].id == "mock-id"
236236
237237
@@ -246,7 +246,7 @@ async def test_setup_user_notify_service(hass: HomeAssistant) -> None:
246246
247247 flow = await notify_auth_module .async_setup_flow ("test-user" )
248248 step = await flow .async_step_init ()
249- assert step ["type" ] == data_entry_flow .FlowResultType .FORM
249+ assert step ["type" ] is data_entry_flow .FlowResultType .FORM
250250 assert step ["step_id" ] == "init"
251251 schema = step ["data_schema" ]
252252 schema ({"notify_service" : "test2" })
@@ -277,7 +277,7 @@ async def test_setup_user_notify_service(hass: HomeAssistant) -> None:
277277
278278 with patch ("pyotp.HOTP.at" , return_value = MOCK_CODE ):
279279 step = await flow .async_step_init ({"notify_service" : "test1" })
280- assert step ["type" ] == data_entry_flow .FlowResultType .FORM
280+ assert step ["type" ] is data_entry_flow .FlowResultType .FORM
281281 assert step ["step_id" ] == "setup"
282282
283283 # wait service call finished
@@ -357,7 +357,7 @@ async def test_setup_user_no_notify_service(hass: HomeAssistant) -> None:
357357
358358 flow = await notify_auth_module .async_setup_flow ("test-user" )
359359 step = await flow .async_step_init ()
360- assert step ["type" ] == data_entry_flow .FlowResultType .ABORT
360+ assert step ["type" ] is data_entry_flow .FlowResultType .ABORT
361361 assert step ["reason" ] == "no_available_service"
362362
363363
@@ -394,13 +394,13 @@ async def test_not_raise_exception_when_service_not_exist(hass: HomeAssistant) -
394394 provider = hass .auth .auth_providers [0 ]
395395
396396 result = await hass .auth .login_flow .async_init ((provider .type , provider .id ))
397- assert result ["type" ] == data_entry_flow .FlowResultType .FORM
397+ assert result ["type" ] is data_entry_flow .FlowResultType .FORM
398398
399399 with patch ("pyotp.HOTP.at" , return_value = MOCK_CODE ):
400400 result = await hass .auth .login_flow .async_configure (
401401 result ["flow_id" ], {"username" : "test-user" , "password" : "test-pass" }
402402 )
403- assert result ["type" ] == data_entry_flow .FlowResultType .ABORT
403+ assert result ["type" ] is data_entry_flow .FlowResultType .ABORT
404404 assert result ["reason" ] == "unknown_error"
405405
406406 # wait service call finished
0 commit comments