mirror of
				https://github.com/home-assistant/core.git
				synced 2025-10-31 06:29:31 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			2025.10.4
			...
			reolink_mo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b06d86d085 | ||
|   | 00199013e7 | 
| @@ -71,97 +71,7 @@ def reolink_connect_class() -> Generator[MagicMock]: | ||||
|         ) as host_mock_class, | ||||
|     ): | ||||
|         host_mock = host_mock_class.return_value | ||||
|         host_mock.get_host_data.return_value = None | ||||
|         host_mock.get_states.return_value = None | ||||
|         host_mock.supported.return_value = True | ||||
|         host_mock.check_new_firmware.return_value = False | ||||
|         host_mock.unsubscribe.return_value = True | ||||
|         host_mock.logout.return_value = True | ||||
|         host_mock.is_nvr = True | ||||
|         host_mock.is_hub = False | ||||
|         host_mock.mac_address = TEST_MAC | ||||
|         host_mock.uid = TEST_UID | ||||
|         host_mock.onvif_enabled = True | ||||
|         host_mock.rtmp_enabled = True | ||||
|         host_mock.rtsp_enabled = True | ||||
|         host_mock.nvr_name = TEST_NVR_NAME | ||||
|         host_mock.port = TEST_PORT | ||||
|         host_mock.use_https = TEST_USE_HTTPS | ||||
|         host_mock.is_admin = True | ||||
|         host_mock.user_level = "admin" | ||||
|         host_mock.protocol = "rtsp" | ||||
|         host_mock.channels = [0] | ||||
|         host_mock.stream_channels = [0] | ||||
|         host_mock.new_devices = False | ||||
|         host_mock.sw_version_update_required = False | ||||
|         host_mock.hardware_version = "IPC_00000" | ||||
|         host_mock.sw_version = "v1.0.0.0.0.0000" | ||||
|         host_mock.sw_upload_progress.return_value = 100 | ||||
|         host_mock.manufacturer = "Reolink" | ||||
|         host_mock.model = TEST_HOST_MODEL | ||||
|         host_mock.item_number.return_value = TEST_ITEM_NUMBER | ||||
|         host_mock.camera_model.return_value = TEST_CAM_MODEL | ||||
|         host_mock.camera_name.return_value = TEST_NVR_NAME | ||||
|         host_mock.camera_hardware_version.return_value = "IPC_00001" | ||||
|         host_mock.camera_sw_version.return_value = "v1.1.0.0.0.0000" | ||||
|         host_mock.camera_sw_version_update_required.return_value = False | ||||
|         host_mock.camera_uid.return_value = TEST_UID_CAM | ||||
|         host_mock.camera_online.return_value = True | ||||
|         host_mock.channel_for_uid.return_value = 0 | ||||
|         host_mock.get_encoding.return_value = "h264" | ||||
|         host_mock.firmware_update_available.return_value = False | ||||
|         host_mock.session_active = True | ||||
|         host_mock.timeout = 60 | ||||
|         host_mock.renewtimer.return_value = 600 | ||||
|         host_mock.wifi_connection = False | ||||
|         host_mock.wifi_signal = None | ||||
|         host_mock.whiteled_mode_list.return_value = [] | ||||
|         host_mock.zoom_range.return_value = { | ||||
|             "zoom": {"pos": {"min": 0, "max": 100}}, | ||||
|             "focus": {"pos": {"min": 0, "max": 100}}, | ||||
|         } | ||||
|         host_mock.capabilities = {"Host": ["RTSP"], "0": ["motion_detection"]} | ||||
|         host_mock.checked_api_versions = {"GetEvents": 1} | ||||
|         host_mock.abilities = {"abilityChn": [{"aiTrack": {"permit": 0, "ver": 0}}]} | ||||
|         host_mock.get_raw_host_data.return_value = ( | ||||
|             "{'host':'TEST_RESPONSE','channel':'TEST_RESPONSE'}" | ||||
|         ) | ||||
|  | ||||
|         reolink_connect.chime_list = [] | ||||
|  | ||||
|         # enums | ||||
|         host_mock.whiteled_mode.return_value = 1 | ||||
|         host_mock.whiteled_mode_list.return_value = ["off", "auto"] | ||||
|         host_mock.doorbell_led.return_value = "Off" | ||||
|         host_mock.doorbell_led_list.return_value = ["stayoff", "auto"] | ||||
|         host_mock.auto_track_method.return_value = 3 | ||||
|         host_mock.daynight_state.return_value = "Black&White" | ||||
|         host_mock.hub_alarm_tone_id.return_value = 1 | ||||
|         host_mock.hub_visitor_tone_id.return_value = 1 | ||||
|         host_mock.recording_packing_time_list = ["30 Minutes", "60 Minutes"] | ||||
|         host_mock.recording_packing_time = "60 Minutes" | ||||
|  | ||||
|         # Baichuan | ||||
|         host_mock.baichuan = create_autospec(Baichuan) | ||||
|         host_mock.baichuan_only = False | ||||
|         # Disable tcp push by default for tests | ||||
|         host_mock.baichuan.port = TEST_BC_PORT | ||||
|         host_mock.baichuan.events_active = False | ||||
|         host_mock.baichuan.mac_address.return_value = TEST_MAC_CAM | ||||
|         host_mock.baichuan.privacy_mode.return_value = False | ||||
|         host_mock.baichuan.day_night_state.return_value = "day" | ||||
|         host_mock.baichuan.subscribe_events.side_effect = ReolinkError("Test error") | ||||
|         host_mock.baichuan.active_scene = "off" | ||||
|         host_mock.baichuan.scene_names = ["off", "home"] | ||||
|         host_mock.baichuan.abilities = { | ||||
|             0: {"chnID": 0, "aitype": 34615}, | ||||
|             "Host": {"pushAlarm": 7}, | ||||
|         } | ||||
|         host_mock.baichuan.smart_location_list.return_value = [0] | ||||
|         host_mock.baichuan.smart_ai_type_list.return_value = ["people"] | ||||
|         host_mock.baichuan.smart_ai_index.return_value = 1 | ||||
|         host_mock.baichuan.smart_ai_name.return_value = "zone1" | ||||
|  | ||||
|         yield host_mock_class | ||||
|  | ||||
|  | ||||
| @@ -170,7 +80,97 @@ def reolink_connect( | ||||
|     reolink_connect_class: MagicMock, | ||||
| ) -> Generator[MagicMock]: | ||||
|     """Mock reolink connection.""" | ||||
|     return reolink_connect_class.return_value | ||||
|     host_mock = reolink_connect_class.return_value | ||||
|     host_mock.get_host_data.return_value = None | ||||
|     host_mock.get_states.return_value = None | ||||
|     host_mock.supported.return_value = True | ||||
|     host_mock.check_new_firmware.return_value = False | ||||
|     host_mock.unsubscribe.return_value = True | ||||
|     host_mock.logout.return_value = True | ||||
|     host_mock.is_nvr = True | ||||
|     host_mock.is_hub = False | ||||
|     host_mock.mac_address = TEST_MAC | ||||
|     host_mock.uid = TEST_UID | ||||
|     host_mock.onvif_enabled = True | ||||
|     host_mock.rtmp_enabled = True | ||||
|     host_mock.rtsp_enabled = True | ||||
|     host_mock.nvr_name = TEST_NVR_NAME | ||||
|     host_mock.port = TEST_PORT | ||||
|     host_mock.use_https = TEST_USE_HTTPS | ||||
|     host_mock.is_admin = True | ||||
|     host_mock.user_level = "admin" | ||||
|     host_mock.protocol = "rtsp" | ||||
|     host_mock.channels = [0] | ||||
|     host_mock.stream_channels = [0] | ||||
|     host_mock.new_devices = False | ||||
|     host_mock.sw_version_update_required = False | ||||
|     host_mock.hardware_version = "IPC_00000" | ||||
|     host_mock.sw_version = "v1.0.0.0.0.0000" | ||||
|     host_mock.sw_upload_progress.return_value = 100 | ||||
|     host_mock.manufacturer = "Reolink" | ||||
|     host_mock.model = TEST_HOST_MODEL | ||||
|     host_mock.item_number.return_value = TEST_ITEM_NUMBER | ||||
|     host_mock.camera_model.return_value = TEST_CAM_MODEL | ||||
|     host_mock.camera_name.return_value = TEST_NVR_NAME | ||||
|     host_mock.camera_hardware_version.return_value = "IPC_00001" | ||||
|     host_mock.camera_sw_version.return_value = "v1.1.0.0.0.0000" | ||||
|     host_mock.camera_sw_version_update_required.return_value = False | ||||
|     host_mock.camera_uid.return_value = TEST_UID_CAM | ||||
|     host_mock.camera_online.return_value = True | ||||
|     host_mock.channel_for_uid.return_value = 0 | ||||
|     host_mock.get_encoding.return_value = "h264" | ||||
|     host_mock.firmware_update_available.return_value = False | ||||
|     host_mock.session_active = True | ||||
|     host_mock.timeout = 60 | ||||
|     host_mock.renewtimer.return_value = 600 | ||||
|     host_mock.wifi_connection = False | ||||
|     host_mock.wifi_signal = None | ||||
|     host_mock.whiteled_mode_list.return_value = [] | ||||
|     host_mock.zoom_range.return_value = { | ||||
|         "zoom": {"pos": {"min": 0, "max": 100}}, | ||||
|         "focus": {"pos": {"min": 0, "max": 100}}, | ||||
|     } | ||||
|     host_mock.capabilities = {"Host": ["RTSP"], "0": ["motion_detection"]} | ||||
|     host_mock.checked_api_versions = {"GetEvents": 1} | ||||
|     host_mock.abilities = {"abilityChn": [{"aiTrack": {"permit": 0, "ver": 0}}]} | ||||
|     host_mock.get_raw_host_data.return_value = ( | ||||
|         "{'host':'TEST_RESPONSE','channel':'TEST_RESPONSE'}" | ||||
|     ) | ||||
|  | ||||
|     reolink_connect.chime_list = [] | ||||
|  | ||||
|     # enums | ||||
|     host_mock.whiteled_mode.return_value = 1 | ||||
|     host_mock.whiteled_mode_list.return_value = ["off", "auto"] | ||||
|     host_mock.doorbell_led.return_value = "Off" | ||||
|     host_mock.doorbell_led_list.return_value = ["stayoff", "auto"] | ||||
|     host_mock.auto_track_method.return_value = 3 | ||||
|     host_mock.daynight_state.return_value = "Black&White" | ||||
|     host_mock.hub_alarm_tone_id.return_value = 1 | ||||
|     host_mock.hub_visitor_tone_id.return_value = 1 | ||||
|     host_mock.recording_packing_time_list = ["30 Minutes", "60 Minutes"] | ||||
|     host_mock.recording_packing_time = "60 Minutes" | ||||
|  | ||||
|     # Baichuan | ||||
|     host_mock.baichuan_only = False | ||||
|     # Disable tcp push by default for tests | ||||
|     host_mock.baichuan.port = TEST_BC_PORT | ||||
|     host_mock.baichuan.events_active = False | ||||
|     host_mock.baichuan.mac_address.return_value = TEST_MAC_CAM | ||||
|     host_mock.baichuan.privacy_mode.return_value = False | ||||
|     host_mock.baichuan.day_night_state.return_value = "day" | ||||
|     host_mock.baichuan.subscribe_events.side_effect = ReolinkError("Test error") | ||||
|     host_mock.baichuan.active_scene = "off" | ||||
|     host_mock.baichuan.scene_names = ["off", "home"] | ||||
|     host_mock.baichuan.abilities = { | ||||
|         0: {"chnID": 0, "aitype": 34615}, | ||||
|         "Host": {"pushAlarm": 7}, | ||||
|     } | ||||
|     host_mock.baichuan.smart_location_list.return_value = [0] | ||||
|     host_mock.baichuan.smart_ai_type_list.return_value = ["people"] | ||||
|     host_mock.baichuan.smart_ai_index.return_value = 1 | ||||
|     host_mock.baichuan.smart_ai_name.return_value = "zone1" | ||||
|     return host_mock | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
|   | ||||
| @@ -141,6 +141,7 @@ async def test_browsing( | ||||
|     entry_id = config_entry.entry_id | ||||
|     reolink_connect.supported.return_value = 1 | ||||
|     reolink_connect.model = "Reolink TrackMix PoE" | ||||
|     reolink_connect.is_nvr = False | ||||
|  | ||||
|     with patch("homeassistant.components.reolink.PLATFORMS", [Platform.CAMERA]): | ||||
|         assert await hass.config_entries.async_setup(entry_id) is True | ||||
|   | ||||
		Reference in New Issue
	
	Block a user