Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

Added coverage for the new admin_only camera flag to verify admin vs normal user access over the HTTP API.

  • New handler tests: Exercised /picture/<id>/current with admin_only enabled/disabled to assert 200 for admins (signature-auth) and 403 for normal users.
  • Test scaffolding: Stubbed handler response and injected minimal config/cache state for deterministic access-control checks.

Example:

# admin-only camera allows admin via signed request, blocks normal user
path = '/picture/1/current?_username=admin'
url = f'{path}&_signature={compute_signature("GET", path, b"", "adm1n")}'
resp = self.fetch(url)          # 200
resp_user = self.fetch('/picture/1/current')  # 403 when @admin_only = True
Original prompt

Please add tests for the new admin_only flag added in #3245. Open the pull requests against the HEAD branch of #3245.

The tests shall cover access with the users admin and user, which are hardcoded in motionEye, with and without the admin-only flag. Apart of unit tests, additional tests with the web API on a locally running motionEye daemon would be a great addition.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Marijn0 added 3 commits December 17, 2025 20:33
Add an admin_only flag to camera configuration and enforce it across the UI and handlers.

Admin-only cameras are hidden from non-admin users in camera listings and are blocked
from accessing pictures, movies, actions, and live frames. The flag is synced for remote
cameras, configurable via the UI, and is disabled by default.
Copilot AI self-assigned this Dec 19, 2025
Copilot AI changed the title [WIP] Add tests for admin_only flag functionality Add admin-only camera access tests for picture handler Dec 19, 2025
Copilot AI requested a review from MichaIng December 19, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants