From f75ab789e91dcf834422c934d7f335edb18cd0f1 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 9 Sep 2011 12:45:20 +0200
Subject: [PATCH] rlib2: Add test for /2/info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 test/ganeti.rapi.rlib2_unittest.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/test/ganeti.rapi.rlib2_unittest.py b/test/ganeti.rapi.rlib2_unittest.py
index 1557587d9..2807a3b9d 100755
--- a/test/ganeti.rapi.rlib2_unittest.py
+++ b/test/ganeti.rapi.rlib2_unittest.py
@@ -1650,5 +1650,24 @@ class TestSimpleResources(unittest.TestCase):
     self.assertEqual(handler.GET(), constants.RAPI_VERSION)
 
 
+class TestClusterInfo(unittest.TestCase):
+  class _ClusterInfoClient:
+    def __init__(self):
+      self.cluster_info = None
+
+    def QueryClusterInfo(self):
+      assert self.cluster_info is None
+      self.cluster_info = object()
+      return self.cluster_info
+
+  def test(self):
+    clfactory = _FakeClientFactory(self._ClusterInfoClient)
+    handler = _CreateHandler(rlib2.R_2_info, [], {}, None, clfactory)
+    result = handler.GET()
+    cl = clfactory.GetNextClient()
+    self.assertRaises(IndexError, clfactory.GetNextClient)
+    self.assertEqual(result, cl.cluster_info)
+
+
 if __name__ == '__main__':
   testutils.GanetiTestProgram()
-- 
GitLab