Files
offline-db/apps/watchparty/tests/test_security_my_rooms.py
Barış Keserandgoogle-labs-jules[bot] 5ebea1debc 🛡️ Sentinel: [MEDIUM] Fix missing authentication on my_rooms endpoint (#243)
- Added IsAuthenticated permission_class to the my_rooms custom action
  in RoomViewSet to prevent unauthenticated access.
- Added a test case `test_my_rooms_unauthenticated` to verify the fix.
- Updated .jules/sentinel.md with the security learning.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-03-10 21:30:31 +03:00

14 lines
509 B
Python

import pytest
from django.test import Client
from django.urls import reverse
@pytest.mark.django_db
def test_my_rooms_unauthenticated():
client = Client()
# The action URL is typically named `basename-action-name`
# Default router basename for RoomViewSet is `room`
url = reverse('room-my-rooms')
# Use follow=True or explicitly request the trailing slash URL
response = client.get(url, follow=True)
assert response.status_code == 401, f"Expected 401, got {response.status_code}"