def test_jsonrpc(self): with patch('uiautomator.JsonRPCMethod') as JsonRPCMethod: client = JsonRPCClient(self.url, self.timeout) JsonRPCMethod.return_value = "Ok" self.assertEqual(client.ping, "Ok") JsonRPCMethod.assert_called_once_with(self.url, "ping", timeout=self.timeout) JsonRPCMethod.return_value = {"width": 10, "height": 20} self.assertEqual(client.info, {"width": 10, "height": 20}) JsonRPCMethod.assert_called_with(self.url, "info", timeout=self.timeout)