Debian Codegraph @

tests/__snapshots__/test_service_discovery.ambr

raw
1 # serializer version: 1
2 # name: test_action_url_returns_cached_url
3 dict({
4 'log': '''
5 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
6 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
7 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
8 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
9 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
10 [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action
11 ''',
12 'result': 'https://example.com/test/test/action',
13 })
14 # ---
15 # name: test_action_url_returns_fallback_url
16 dict({
17 'log': '[INFO] hass_nabucasa.service_discovery: Using fallback action URL for test_api_action: https://example.com/test/fallback/action',
18 'result': 'https://example.com/test/fallback/action',
19 })
20 # ---
21 # name: test_action_url_with_format_parameters
22 dict({
23 'log': '''
24 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
25 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
26 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
27 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
28 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
29 [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action
30 ''',
31 'result': 'https://example.com/test/test/action',
32 })
33 # ---
34 # name: test_action_url_with_override
35 dict({
36 'log': '[INFO] hass_nabucasa.service_discovery: Using overridden action URL for test_api_action: https://override.example.com/custom',
37 'result': 'https://override.example.com/custom',
38 })
39 # ---
40 # name: test_background_refresh_with_changing_network_conditions
41 dict({
42 'log': '''
43 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
44 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
45 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
46 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
47 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
48 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
49 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
50 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
51 [DEBUG] hass_nabucasa.service_discovery: Service discovery 2.0 with 1 actions fetched
52 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
53 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
54 ''',
55 'result': dict({
56 'cache_updated': True,
57 'first_version': '1.0',
58 'second_version': '2.0',
59 }),
60 })
61 # ---
62 # name: test_background_refresh_with_no_cache_uses_12_hour_retry
63 dict({
64 'log': '''
65 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
66 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (500)
67 [DEBUG] hass_nabucasa.service_discovery: Failed to load initial service discovery data: Failed to parse API response
68 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 12h:1m:51s
69 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
70 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
71 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
72 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
73 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
74 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
75 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
76 ''',
77 'result': dict({
78 'cache_populated_after_retry': True,
79 'version': '1.0',
80 }),
81 })
82 # ---
83 # name: test_extremely_long_running_refresh_cycle
84 dict({
85 'log': '''
86 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
87 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
88 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
89 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 365d
90 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
91 [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action
92 ''',
93 'result': dict({
94 'task_running': True,
95 'url': 'https://example.com/test/test/action',
96 'valid_for': 31536000,
97 }),
98 })
99 # ---
100 # name: test_fetch_well_known_success
101 dict({
102 'log': '''
103 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
104 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
105 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
106 ''',
107 'result': dict({
108 'actions': dict({
109 'test_api_action': 'https://example.com/test/{param}/action',
110 }),
111 'valid_for': 3600,
112 'version': '1.0',
113 }),
114 })
115 # ---
116 # name: test_forward_compatibility_combined
117 dict({
118 'log': '''
119 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
120 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
121 [DEBUG] hass_nabucasa.service_discovery: Service discovery 2.0 with 1 actions fetched
122 ''',
123 'result': dict({
124 'actions': dict({
125 'test_api_action': 'https://example.com/test/{param}/action',
126 }),
127 'valid_for': 3600,
128 'version': '2.0',
129 }),
130 })
131 # ---
132 # name: test_forward_compatibility_extra_actions
133 dict({
134 'log': '''
135 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
136 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
137 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
138 ''',
139 'result': dict({
140 'actions': dict({
141 'test_api_action': 'https://example.com/test/{param}/action',
142 }),
143 'valid_for': 3600,
144 'version': '1.0',
145 }),
146 })
147 # ---
148 # name: test_forward_compatibility_extra_top_level_fields
149 dict({
150 'log': '''
151 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
152 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
153 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
154 ''',
155 'result': dict({
156 'actions': dict({
157 'test_api_action': 'https://example.com/test/{param}/action',
158 }),
159 'valid_for': 3600,
160 'version': '1.0',
161 }),
162 })
163 # ---
164 # name: test_invalid_action_name_in_response
165 dict({
166 'log': '''
167 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
168 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
169 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
170 ''',
171 'result': dict({
172 'actions': dict({
173 'test_api_action': 'https://example.com/test/{param}/action',
174 }),
175 'valid_for': 3600,
176 'version': '1.0',
177 }),
178 })
179 # ---
180 # name: test_load_service_discovery_data_caches_result
181 dict({
182 'log': '''
183 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
184 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
185 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
186 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
187 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
188 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
189 ''',
190 'result': dict({
191 'cache1': dict({
192 'actions': dict({
193 'test_api_action': 'https://example.com/test/{param}/action',
194 }),
195 'valid_for': 3600,
196 'version': '1.0',
197 }),
198 'cache2': dict({
199 'actions': dict({
200 'test_api_action': 'https://example.com/test/{param}/action',
201 }),
202 'valid_for': 3600,
203 'version': '1.0',
204 }),
205 }),
206 })
207 # ---
208 # name: test_load_service_discovery_data_uses_expired_cache_on_failure
209 dict({
210 'log': '''
211 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
212 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
213 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
214 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
215 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
216 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
217 ''',
218 'result': dict({
219 'cache1': dict({
220 'actions': dict({
221 'test_api_action': 'https://example.com/test/{param}/action',
222 }),
223 'valid_for': 3600,
224 'version': '1.0',
225 }),
226 'cache2': dict({
227 'actions': dict({
228 'test_api_action': 'https://example.com/test/{param}/action',
229 }),
230 'valid_for': 3600,
231 'version': '1.0',
232 }),
233 }),
234 })
235 # ---
236 # name: test_network_failure_during_background_refresh
237 dict({
238 'log': '''
239 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
240 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
241 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
242 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 0s
243 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
244 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s
245 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
246 ''',
247 'result': dict({
248 'cache_preserved': True,
249 }),
250 })
251 # ---
252 # name: test_race_condition_multiple_concurrent_stops
253 dict({
254 'log': '''
255 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
256 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
257 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
258 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1s
259 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
260 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s
261 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
262 ''',
263 'result': dict({
264 'task_stopped': True,
265 }),
266 })
267 # ---
268 # name: test_race_condition_stop_and_start_rapid_cycling
269 dict({
270 'log': '''
271 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
272 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
273 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
274 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h
275 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
276 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
277 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
278 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
279 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
280 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
281 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
282 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
283 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
284 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
285 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
286 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
287 [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data
288 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s
289 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
290 ''',
291 'result': dict({
292 'final_state_clean': True,
293 }),
294 })
295 # ---
296 # name: test_race_condition_stop_during_fetch
297 dict({
298 'log': '''
299 [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery
300 [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200)
301 [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched
302 [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 0s
303 [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update
304 [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s
305 [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled
306 ''',
307 'result': dict({
308 'task_stopped': True,
309 }),
310 })
311 # ---
312 # name: test_service_discovery_with_action_overrides
313 dict({
314 'log': '[INFO] hass_nabucasa.service_discovery: Using overridden action URL for test_api_action: https://override.example.com/custom',
315 'result': 'https://override.example.com/custom',
316 })
317 # ---