def test_generate_invalid(self): result = upload.generate({'hostname': '10.0.1-2.2-254', 'version': 'D7-H.1.0.0'}) self.assertEqual( len(result), 2 * 253, result)
def test_generate_list(self): result = upload.generate({'hostname': ('hosta', 'hostb', 'hostc')}) self.assertEqual( result, [{'hostname': 'hosta'}, {'hostname': 'hostb'}, {'hostname': 'hostc'}] )
def test_generate(self): model = {'gw': '192.168.1.1', 'ip': '192.168.1.10-12', 'hostname': 'host10-12'} self.assertEqual( upload.generate(model), [{'gw': '192.168.1.1', 'ip': '192.168.1.10', 'hostname': 'host10'}, {'gw': '192.168.1.1', 'ip': '192.168.1.11', 'hostname': 'host11'}, {'gw': '192.168.1.1', 'ip': '192.168.1.12', 'hostname': 'host12'}] )
def test_generate_none(self): model = {'gateway': '10.66.6.1', 'ip': '10.66.6.100', 'netmask': '255.255.255.0', 'gateway-ipmi': '10.66.6.1', 'ip-ipmi': '10.66.6.110', 'netmask-ipmi': '255.255.255.0', 'hostname': 'hp-grid' } result = upload.generate(model) self.assertEqual(result, [model])
def test_generate_with_zeros(self): model = {'gw': '192.168.1.1', 'ip': '192.168.1.1-6', 'hostname': 'ceph001-006'} self.assertEqual( upload.generate(model), [{'gw': '192.168.1.1', 'ip': '192.168.1.1', 'hostname': 'ceph001'}, {'gw': '192.168.1.1', 'ip': '192.168.1.2', 'hostname': 'ceph002'}, {'gw': '192.168.1.1', 'ip': '192.168.1.3', 'hostname': 'ceph003'}, {'gw': '192.168.1.1', 'ip': '192.168.1.4', 'hostname': 'ceph004'}, {'gw': '192.168.1.1', 'ip': '192.168.1.5', 'hostname': 'ceph005'}, {'gw': '192.168.1.1', 'ip': '192.168.1.6', 'hostname': 'ceph006'}, ] )
def test_generate_253(self): result = upload.generate({'hostname': '10.0.1-2.2-254'}) self.assertEqual( len(result), 2 * 253, result)
def test_generate_invalid(self): result = upload.generate({ 'hostname': '10.0.1-2.2-254', 'version': 'D7-H.1.0.0' }) self.assertEqual(len(result), 2 * 253, result)