# serializer version: 1 # name: test_action_url_returns_cached_url dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action ''', 'result': 'https://example.com/test/test/action', }) # --- # name: test_action_url_returns_fallback_url dict({ 'log': '[INFO] hass_nabucasa.service_discovery: Using fallback action URL for test_api_action: https://example.com/test/fallback/action', 'result': 'https://example.com/test/fallback/action', }) # --- # name: test_action_url_with_format_parameters dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action ''', 'result': 'https://example.com/test/test/action', }) # --- # name: test_action_url_with_override dict({ 'log': '[INFO] hass_nabucasa.service_discovery: Using overridden action URL for test_api_action: https://override.example.com/custom', 'result': 'https://override.example.com/custom', }) # --- # name: test_background_refresh_with_changing_network_conditions dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 2.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update ''', 'result': dict({ 'cache_updated': True, 'first_version': '1.0', 'second_version': '2.0', }), }) # --- # name: test_background_refresh_with_no_cache_uses_12_hour_retry dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (500) [DEBUG] hass_nabucasa.service_discovery: Failed to load initial service discovery data: Failed to parse API response [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 12h:1m:51s [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled ''', 'result': dict({ 'cache_populated_after_retry': True, 'version': '1.0', }), }) # --- # name: test_extremely_long_running_refresh_cycle dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 365d [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Using cached action URL for test_api_action: https://example.com/test/{param}/action ''', 'result': dict({ 'task_running': True, 'url': 'https://example.com/test/test/action', 'valid_for': 31536000, }), }) # --- # name: test_fetch_well_known_success dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched ''', 'result': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }) # --- # name: test_forward_compatibility_combined dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 2.0 with 1 actions fetched ''', 'result': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '2.0', }), }) # --- # name: test_forward_compatibility_extra_actions dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched ''', 'result': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }) # --- # name: test_forward_compatibility_extra_top_level_fields dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched ''', 'result': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }) # --- # name: test_invalid_action_name_in_response dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched ''', 'result': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }) # --- # name: test_load_service_discovery_data_caches_result dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data ''', 'result': dict({ 'cache1': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), 'cache2': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }), }) # --- # name: test_load_service_discovery_data_uses_expired_cache_on_failure dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data ''', 'result': dict({ 'cache1': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), 'cache2': dict({ 'actions': dict({ 'test_api_action': 'https://example.com/test/{param}/action', }), 'valid_for': 3600, 'version': '1.0', }), }), }) # --- # name: test_network_failure_during_background_refresh dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 0s [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled ''', 'result': dict({ 'cache_preserved': True, }), }) # --- # name: test_race_condition_multiple_concurrent_stops dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1s [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled ''', 'result': dict({ 'task_stopped': True, }), }) # --- # name: test_race_condition_stop_and_start_rapid_cycling dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 1h [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled [DEBUG] hass_nabucasa.service_discovery: Using cached service discovery data [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1h:1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled ''', 'result': dict({ 'final_state_clean': True, }), }) # --- # name: test_race_condition_stop_during_fetch dict({ 'log': ''' [DEBUG] hass_nabucasa.api: Sending GET request to api.example.com/.well-known/service-discovery [DEBUG] hass_nabucasa.api: Response for get from api.example.com/.well-known/service-discovery (200) [DEBUG] hass_nabucasa.service_discovery: Service discovery 1.0 with 1 actions fetched [DEBUG] hass_nabucasa.service_discovery: Service discovery data cached, valid for 0s [DEBUG] hass_nabucasa.events.bus: No subscribers for event service_discovery_update [DEBUG] hass_nabucasa.service_discovery: Scheduling service discovery refresh in 1m:51s [DEBUG] hass_nabucasa.service_discovery: Service discovery refresh task cancelled ''', 'result': dict({ 'task_stopped': True, }), }) # --- # name: test_service_discovery_with_action_overrides dict({ 'log': '[INFO] hass_nabucasa.service_discovery: Using overridden action URL for test_api_action: https://override.example.com/custom', 'result': 'https://override.example.com/custom', }) # ---