Skip to content

Commit

Permalink
remove dlt ptz (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
MateoLostanlen authored Dec 31, 2024
1 parent cb2f13b commit 011757f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
10 changes: 0 additions & 10 deletions src/control_reolink_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def main():
- `move_in_seconds`: Moves the camera in a specified direction for a certain duration.
- `get_ptz_preset`: Retrieves the list of PTZ preset positions.
- `set_ptz_preset`: Sets a PTZ preset position.
- `delete_ptz_preset`: Deletes a PTZ preset position.
- `reboot_camera`: Reboots the camera.
- `get_auto_focus`: Retrieves the current auto-focus settings.
- `set_auto_focus`: Enables or disables the auto-focus.
Expand All @@ -46,9 +45,6 @@ def main():
- Set a PTZ preset at position 1:
python src/control_reolink_cam.py set_ptz_preset --ip 169.254.40.1 --pos_id 1
- Delete a PTZ preset at position 1:
python src/control_reolink_cam.py delete_ptz_preset --ip 169.254.40.1 --pos_id 1
- Reboot the camera:
python src/control_reolink_cam.py reboot_camera --ip 169.254.40.1 --type ptz
Expand Down Expand Up @@ -76,7 +72,6 @@ def main():
"move_in_seconds",
"get_ptz_preset",
"set_ptz_preset",
"delete_ptz_preset",
"reboot_camera",
"get_auto_focus",
"set_auto_focus",
Expand Down Expand Up @@ -130,11 +125,6 @@ def main():
camera_controller.set_ptz_preset(idx=args.pos_id)
else:
print("Position ID must be provided for setting a PTZ preset.")
elif args.action == "delete_ptz_preset":
if args.pos_id is not None:
camera_controller.delete_ptz_preset(idx=args.pos_id)
else:
print("Position ID must be provided for deleting a PTZ preset.")
elif args.action == "reboot_camera":
camera_controller.reboot_camera()
print("Camera reboot initiated.")
Expand Down
26 changes: 0 additions & 26 deletions tests/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,32 +103,6 @@ def test_move_in_seconds():
mock_move_camera.assert_any_call("Stop")


def test_delete_ptz_preset_success():
# Mock the response of requests.post to return a successful response for deleting preset
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.json.return_value = [{"code": 0}]

with patch("requests.post", return_value=mock_response):
camera = ReolinkCamera("192.168.1.1", "login", "pwd", "ptz")
camera.delete_ptz_preset(idx=1)
# Assert that the delete_ptz_preset method was called successfully
assert mock_response.json.call_count == 1


def test_delete_ptz_preset_failure():
# Mock the response of requests.post to return a failed response
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.json.return_value = [{"code": 1, "error": "Some error"}]

with patch("requests.post", return_value=mock_response):
camera = ReolinkCamera("192.168.1.1", "login", "pwd", "ptz")
camera.delete_ptz_preset(idx=1)
# Assert that a failed operation logs an error message
assert mock_response.json.call_count == 1


def test_reboot_camera_success():
# Mock the response of requests.post to return a successful response for reboot
mock_response = MagicMock()
Expand Down

0 comments on commit 011757f

Please sign in to comment.