def test_get_ip_address(self): self.assertEqual("192.168.0.3", server._get_ip_address(self.OLD, "private", [4, 6])) self.assertEqual("10.10.1.2", server._get_ip_address(self.NEW, "fixed", [4, 6])) self.assertEqual("10.10.1.2", server._get_ip_address(self.NEW, "private", [4, 6])) self.assertEqual("0:0:0:0:0:ffff:a0a:103", server._get_ip_address(self.NEW, "public", [6])) self.assertEqual("0:0:0:0:0:ffff:a0a:103", server._get_ip_address(self.NEW, "floating", [6])) self.assertEqual("124.12.125.4", server._get_ip_address(self.ODD, "public", [4, 6])) self.assertEqual("10.3.3.18", server._get_ip_address(self.ODD, "private", [4, 6])) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.NEW, "public", [4]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.NEW, "admin", [4]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.OLD, "public", [4, 6]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.OLD, "private", [6])
def test_get_ip_address(self): self.assertEqual("192.168.0.3", server._get_ip_address(self.OLD, 'private', [4, 6])) self.assertEqual("10.10.1.2", server._get_ip_address(self.NEW, 'fixed', [4, 6])) self.assertEqual("10.10.1.2", server._get_ip_address(self.NEW, 'private', [4, 6])) self.assertEqual("0:0:0:0:0:ffff:a0a:103", server._get_ip_address(self.NEW, 'public', [6])) self.assertEqual("0:0:0:0:0:ffff:a0a:103", server._get_ip_address(self.NEW, 'floating', [6])) self.assertEqual("124.12.125.4", server._get_ip_address(self.ODD, 'public', [4, 6])) self.assertEqual("10.3.3.18", server._get_ip_address(self.ODD, 'private', [4, 6])) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.NEW, 'public', [4]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.NEW, 'admin', [4]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.OLD, 'public', [4, 6]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.OLD, 'private', [6])