A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
added test for web socket authentication
jonaswinklerb9e1ed7d7e2a
diff --git a/src/paperless/tests/test_websockets.py b/src/paperless/tests/test_websockets.pynew file mode 100644index 000000000..e5745ce77--- /dev/null+++ b/src/paperless/tests/test_websockets.py@@ -0,0 +1,25 @@+from unittest import mock++from channels.testing import WebsocketCommunicator+from django.test import TestCase++from paperless.asgi import application+++class TestWebSockets(TestCase):++ async def test_no_auth(self):+ communicator = WebsocketCommunicator(application, "/ws/status/")+ connected, subprotocol = await communicator.connect()+ self.assertFalse(connected)+ await communicator.disconnect()++ @mock.patch("paperless.consumers.StatusConsumer._authenticated")+ async def test_auth(self, _authenticated):+ _authenticated.return_value = True++ communicator = WebsocketCommunicator(application, "/ws/status/")+ connected, subprotocol = await communicator.connect()+ self.assertTrue(connected)++ await communicator.disconnect()