mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Change: remove credentials from redis url in system status (#6104)
This commit is contained in:
@@ -100,6 +100,45 @@ class TestSystemStatus(APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response.data["tasks"]["redis_status"], "OK")
|
||||
|
||||
def test_system_status_redis_no_credentials(self):
|
||||
"""
|
||||
GIVEN:
|
||||
- Redis URL with credentials
|
||||
WHEN:
|
||||
- The user requests the system status
|
||||
THEN:
|
||||
- The response contains the redis URL but no credentials
|
||||
"""
|
||||
with override_settings(
|
||||
_CHANNELS_REDIS_URL="redis://username:password@localhost:6379",
|
||||
):
|
||||
self.client.force_login(self.user)
|
||||
response = self.client.get(self.ENDPOINT)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(
|
||||
response.data["tasks"]["redis_url"],
|
||||
"redis://localhost:6379",
|
||||
)
|
||||
|
||||
def test_system_status_redis_socket(self):
|
||||
"""
|
||||
GIVEN:
|
||||
- Redis URL is socket
|
||||
WHEN:
|
||||
- The user requests the system status
|
||||
THEN:
|
||||
- The response contains the redis URL
|
||||
"""
|
||||
|
||||
with override_settings(_CHANNELS_REDIS_URL="unix:///path/to/redis.sock"):
|
||||
self.client.force_login(self.user)
|
||||
response = self.client.get(self.ENDPOINT)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(
|
||||
response.data["tasks"]["redis_url"],
|
||||
"unix:///path/to/redis.sock",
|
||||
)
|
||||
|
||||
@mock.patch("celery.app.control.Inspect.ping")
|
||||
def test_system_status_celery_ping(self, mock_ping):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user