@@ -26,12 +26,12 @@ async def test_user_flow_minimum_fields(hass, pyscript_bypass_setup):
26
26
"""Test user config flow with minimum fields."""
27
27
# test form shows
28
28
result = await hass .config_entries .flow .async_init (DOMAIN , context = {"source" : SOURCE_USER })
29
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
29
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
30
30
assert result ["step_id" ] == "user"
31
31
32
32
result = await hass .config_entries .flow .async_configure (result ["flow_id" ], user_input = {})
33
33
34
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
34
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
35
35
assert CONF_ALLOW_ALL_IMPORTS in result ["data" ]
36
36
assert CONF_HASS_IS_GLOBAL in result ["data" ]
37
37
assert not result ["data" ][CONF_ALLOW_ALL_IMPORTS ]
@@ -44,14 +44,14 @@ async def test_user_flow_all_fields(hass, pyscript_bypass_setup):
44
44
# test form shows
45
45
result = await hass .config_entries .flow .async_init (DOMAIN , context = {"source" : SOURCE_USER })
46
46
47
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
47
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
48
48
assert result ["step_id" ] == "user"
49
49
50
50
result = await hass .config_entries .flow .async_configure (
51
51
result ["flow_id" ], user_input = {CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }
52
52
)
53
53
54
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
54
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
55
55
assert CONF_ALLOW_ALL_IMPORTS in result ["data" ]
56
56
assert result ["data" ][CONF_ALLOW_ALL_IMPORTS ]
57
57
assert result ["data" ][CONF_HASS_IS_GLOBAL ]
@@ -66,15 +66,15 @@ async def test_user_already_configured(hass, pyscript_bypass_setup):
66
66
data = {CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True },
67
67
)
68
68
69
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
69
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
70
70
71
71
result = await hass .config_entries .flow .async_init (
72
72
DOMAIN ,
73
73
context = {"source" : SOURCE_USER },
74
74
data = {CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True },
75
75
)
76
76
77
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
77
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
78
78
assert result ["reason" ] == "single_instance_allowed"
79
79
80
80
@@ -85,7 +85,7 @@ async def test_import_flow(hass, pyscript_bypass_setup):
85
85
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({})
86
86
)
87
87
88
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
88
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
89
89
90
90
91
91
@pytest .mark .asyncio
@@ -95,15 +95,15 @@ async def test_import_flow_update_allow_all_imports(hass, pyscript_bypass_setup)
95
95
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({})
96
96
)
97
97
98
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
98
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
99
99
100
100
result = await hass .config_entries .flow .async_init (
101
101
DOMAIN ,
102
102
context = {"source" : SOURCE_IMPORT },
103
103
data = {CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True },
104
104
)
105
105
106
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
106
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
107
107
assert result ["reason" ] == "updated_entry"
108
108
109
109
@@ -114,13 +114,13 @@ async def test_import_flow_update_apps_from_none(hass, pyscript_bypass_setup):
114
114
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({})
115
115
)
116
116
117
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
117
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
118
118
119
119
result = await hass .config_entries .flow .async_init (
120
120
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = {"apps" : {"test_app" : {"param" : 1 }}}
121
121
)
122
122
123
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
123
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
124
124
assert result ["reason" ] == "updated_entry"
125
125
126
126
@@ -131,11 +131,11 @@ async def test_import_flow_update_apps_to_none(hass, pyscript_bypass_setup):
131
131
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({"apps" : {"test_app" : {"param" : 1 }}})
132
132
)
133
133
134
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
134
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
135
135
136
136
result = await hass .config_entries .flow .async_init (DOMAIN , context = {"source" : SOURCE_IMPORT }, data = {})
137
137
138
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
138
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
139
139
assert result ["reason" ] == "updated_entry"
140
140
141
141
@@ -146,13 +146,13 @@ async def test_import_flow_no_update(hass, pyscript_bypass_setup):
146
146
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({})
147
147
)
148
148
149
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
149
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
150
150
151
151
result = await hass .config_entries .flow .async_init (
152
152
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = PYSCRIPT_SCHEMA ({})
153
153
)
154
154
155
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
155
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
156
156
assert result ["reason" ] == "already_configured"
157
157
158
158
@@ -165,13 +165,13 @@ async def test_import_flow_update_user(hass, pyscript_bypass_setup):
165
165
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
166
166
)
167
167
168
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
168
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
169
169
170
170
result = await hass .config_entries .flow .async_init (
171
171
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = {"apps" : {"test_app" : {"param" : 1 }}}
172
172
)
173
173
174
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
174
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
175
175
assert result ["reason" ] == "updated_entry"
176
176
177
177
assert hass .config_entries .async_entries (DOMAIN )[0 ].data == {
@@ -190,13 +190,13 @@ async def test_import_flow_update_import(hass, pyscript_bypass_setup):
190
190
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
191
191
)
192
192
193
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
193
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
194
194
195
195
result = await hass .config_entries .flow .async_init (
196
196
DOMAIN , context = {"source" : SOURCE_IMPORT }, data = {"apps" : {"test_app" : {"param" : 1 }}}
197
197
)
198
198
199
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_ABORT
199
+ assert result ["type" ] == data_entry_flow .FlowResultType . ABORT
200
200
assert result ["reason" ] == "updated_entry"
201
201
202
202
assert hass .config_entries .async_entries (DOMAIN )[0 ].data == {"apps" : {"test_app" : {"param" : 1 }}}
@@ -211,17 +211,17 @@ async def test_options_flow_import(hass, pyscript_bypass_setup):
211
211
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
212
212
)
213
213
await hass .async_block_till_done ()
214
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
214
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
215
215
entry = result ["result" ]
216
216
217
217
result = await hass .config_entries .options .async_init (entry .entry_id , data = None )
218
218
219
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
219
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
220
220
assert result ["step_id" ] == "no_ui_configuration_allowed"
221
221
222
222
result = await hass .config_entries .options .async_configure (result ["flow_id" ], user_input = None )
223
223
224
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
224
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
225
225
assert result ["title" ] == ""
226
226
227
227
@@ -234,20 +234,20 @@ async def test_options_flow_user_change(hass, pyscript_bypass_setup):
234
234
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
235
235
)
236
236
await hass .async_block_till_done ()
237
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
237
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
238
238
entry = result ["result" ]
239
239
240
240
result = await hass .config_entries .options .async_init (entry .entry_id )
241
241
242
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
242
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
243
243
assert result ["step_id" ] == "init"
244
244
245
245
result = await hass .config_entries .options .async_configure (
246
246
result ["flow_id" ], user_input = {CONF_ALLOW_ALL_IMPORTS : False , CONF_HASS_IS_GLOBAL : False }
247
247
)
248
248
await hass .async_block_till_done ()
249
249
250
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
250
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
251
251
assert result ["title" ] == ""
252
252
253
253
assert entry .data [CONF_ALLOW_ALL_IMPORTS ] is False
@@ -263,24 +263,24 @@ async def test_options_flow_user_no_change(hass, pyscript_bypass_setup):
263
263
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
264
264
)
265
265
await hass .async_block_till_done ()
266
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
266
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
267
267
entry = result ["result" ]
268
268
269
269
result = await hass .config_entries .options .async_init (entry .entry_id )
270
270
271
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
271
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
272
272
assert result ["step_id" ] == "init"
273
273
274
274
result = await hass .config_entries .options .async_configure (
275
275
result ["flow_id" ], user_input = {CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }
276
276
)
277
277
278
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_FORM
278
+ assert result ["type" ] == data_entry_flow .FlowResultType . FORM
279
279
assert result ["step_id" ] == "no_update"
280
280
281
281
result = await hass .config_entries .options .async_configure (result ["flow_id" ], user_input = None )
282
282
283
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
283
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
284
284
assert result ["title" ] == ""
285
285
286
286
@@ -296,7 +296,7 @@ async def test_config_entry_reload(hass):
296
296
data = PYSCRIPT_SCHEMA ({CONF_ALLOW_ALL_IMPORTS : True , CONF_HASS_IS_GLOBAL : True }),
297
297
)
298
298
await hass .async_block_till_done ()
299
- assert result ["type" ] == data_entry_flow .RESULT_TYPE_CREATE_ENTRY
299
+ assert result ["type" ] == data_entry_flow .FlowResultType . CREATE_ENTRY
300
300
entry = result ["result" ]
301
301
listeners = hass .bus .async_listeners ()
302
302
await hass .config_entries .async_reload (entry .entry_id )
0 commit comments