def test_receive_runtime_err(loop): resp = ClientWebSocketResponse(mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, loop) resp._waiting = True with pytest.raises(RuntimeError): yield from resp.receive()
def test_receive_runtime_err(self): resp = ClientWebSocketResponse(mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, self.loop) resp._waiting = True self.assertRaises(RuntimeError, self.loop.run_until_complete, resp.receive())
async def get_account(logged_in: bool = False, load_robots: bool = False) -> Account: """Get an account that has the underlying API patched.""" with patch( "pylitterbot.session.ClientSession.ws_connect", return_value=ClientWebSocketResponse(Mock(), Mock(), Mock(), Mock(), Mock(), Mock(), Mock(), Mock()), ): account = Account() if logged_in: await account.connect(username=USERNAME, password=PASSWORD, load_robots=load_robots) return account