mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	fix websocket test cases
This commit is contained in:
		@@ -8,14 +8,16 @@ from paperless.asgi import application
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class TestWebSockets(TestCase):
 | 
					class TestWebSockets(TestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def test_no_auth(self):
 | 
					    @mock.patch("paperless.consumers.async_to_sync")
 | 
				
			||||||
 | 
					    async def test_no_auth(self, async_to_sync):
 | 
				
			||||||
        communicator = WebsocketCommunicator(application, "/ws/status/")
 | 
					        communicator = WebsocketCommunicator(application, "/ws/status/")
 | 
				
			||||||
        connected, subprotocol = await communicator.connect()
 | 
					        connected, subprotocol = await communicator.connect()
 | 
				
			||||||
        self.assertFalse(connected)
 | 
					        self.assertFalse(connected)
 | 
				
			||||||
        await communicator.disconnect()
 | 
					        await communicator.disconnect()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @mock.patch("paperless.consumers.async_to_sync")
 | 
				
			||||||
    @mock.patch("paperless.consumers.StatusConsumer._authenticated")
 | 
					    @mock.patch("paperless.consumers.StatusConsumer._authenticated")
 | 
				
			||||||
    async def test_auth(self, _authenticated):
 | 
					    async def test_auth(self, _authenticated, async_to_sync):
 | 
				
			||||||
        _authenticated.return_value = True
 | 
					        _authenticated.return_value = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        communicator = WebsocketCommunicator(application, "/ws/status/")
 | 
					        communicator = WebsocketCommunicator(application, "/ws/status/")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user