Revision 4d36fbf4 test/py/ganeti.objects_unittest.py
b/test/py/ganeti.objects_unittest.py | ||
---|---|---|
216 | 216 |
self.assertEqual(self.fake_cl.primary_hypervisor, constants.HT_CHROOT) |
217 | 217 |
|
218 | 218 |
|
219 |
class TestClusterObjectTcpUdpPortPool(unittest.TestCase): |
|
220 |
def testNewCluster(self): |
|
221 |
self.assertTrue(objects.Cluster().tcpudp_port_pool is None) |
|
222 |
|
|
223 |
def testSerializingEmpty(self): |
|
224 |
self.assertEqual(objects.Cluster().ToDict(), { |
|
225 |
"tcpudp_port_pool": [], |
|
226 |
}) |
|
227 |
|
|
228 |
def testSerializing(self): |
|
229 |
cluster = objects.Cluster.FromDict({}) |
|
230 |
self.assertEqual(cluster.tcpudp_port_pool, set()) |
|
231 |
|
|
232 |
cluster.tcpudp_port_pool.add(3546) |
|
233 |
cluster.tcpudp_port_pool.add(62511) |
|
234 |
|
|
235 |
data = cluster.ToDict() |
|
236 |
self.assertEqual(data.keys(), ["tcpudp_port_pool"]) |
|
237 |
self.assertEqual(sorted(data["tcpudp_port_pool"]), sorted([3546, 62511])) |
|
238 |
|
|
239 |
def testDeserializingEmpty(self): |
|
240 |
cluster = objects.Cluster.FromDict({}) |
|
241 |
self.assertEqual(cluster.tcpudp_port_pool, set()) |
|
242 |
|
|
243 |
def testDeserialize(self): |
|
244 |
cluster = objects.Cluster.FromDict({ |
|
245 |
"tcpudp_port_pool": [26214, 10039, 267], |
|
246 |
}) |
|
247 |
self.assertEqual(cluster.tcpudp_port_pool, set([26214, 10039, 267])) |
|
248 |
|
|
249 |
|
|
219 | 250 |
class TestOS(unittest.TestCase): |
220 | 251 |
ALL_DATA = [ |
221 | 252 |
"debootstrap", |
Also available in: Unified diff