def test_fields(self): """Test that facilitator responses contain all the required fields.""" fac.put_reg(FACILITATOR_ADDR, self.IPV4_CLIENT_ADDR, CLIENT_TP) reg = fac.get_reg(FACILITATOR_ADDR, self.IPV4_PROXY_ADDR, PROXY_TPS) self.assertEqual(reg["client"], format_addr(self.IPV4_CLIENT_ADDR)) self.assertEqual(reg["client-transport"], CLIENT_TP) self.assertEqual(reg["relay"], format_addr(self.IPV4_RELAY_ADDR)) self.assertEqual(reg["relay-transport"], RELAY_TP) self.assertGreater(int(reg["check-back-in"]), 0)
def test_af_v6_v6(self): """Test that IPv6 proxies can get IPv6 clients.""" fac.put_reg(FACILITATOR_ADDR, self.IPV4_CLIENT_ADDR, CLIENT_TP) fac.put_reg(FACILITATOR_ADDR, self.IPV6_CLIENT_ADDR, CLIENT_TP) reg = fac.get_reg(FACILITATOR_ADDR, self.IPV6_PROXY_ADDR, PROXY_TPS) self.assertEqual(reg["client"], format_addr(self.IPV6_CLIENT_ADDR))
def test_af_v6_v4(self): """Test that IPv6 proxies do not get IPv4 clients.""" fac.put_reg(FACILITATOR_ADDR, self.IPV4_CLIENT_ADDR, CLIENT_TP) reg = fac.get_reg(FACILITATOR_ADDR, self.IPV6_PROXY_ADDR, PROXY_TPS) self.assertEqual(reg["client"], "")