from ganeti import http
from ganeti.rapi import connector
-from ganeti.rapi import rlib1
from ganeti.rapi import rlib2
+import testutils
+
class MapperTests(unittest.TestCase):
"""Tests for remote API URI mapper."""
self._TestFailingUri("/tags")
self._TestFailingUri("/instances")
- self._TestUri("/version", (rlib1.R_version, [], {}))
+ self._TestUri("/version", (rlib2.R_version, [], {}))
- self._TestUri('/2/instances/www.test.com',
- (rlib1.R_instances_name,
- ['www.test.com'],
+ self._TestUri("/2/instances/www.test.com",
+ (rlib2.R_2_instances_name,
+ ["www.test.com"],
{}))
- self._TestUri('/2/instances/www.test.com/tags?f=5&f=6&alt=html',
+ self._TestUri("/2/instances/www.test.com/tags?f=5&f=6&alt=html",
(rlib2.R_2_instances_name_tags,
- ['www.test.com'],
- {'alt': ['html'],
- 'f': ['5', '6'],
+ ["www.test.com"],
+ {"alt": ["html"],
+ "f": ["5", "6"],
}))
self._TestFailingUri("/tag")
self._TestFailingUri("/instances/does/not/exist")
-class R_RootTests(unittest.TestCase):
- """Testing for R_root class."""
-
- def setUp(self):
- self.root = connector.R_root(None, None, None)
-
- def testGet(self):
- expected = [
- {'name': '2', 'uri': '/2'},
- {'name': 'version', 'uri': '/version'},
- ]
- self.assertEquals(self.root.GET(), expected)
-
-
-if __name__ == '__main__':
- unittest.main()
+if __name__ == "__main__":
+ testutils.GanetiTestProgram()