def test_07_SDOption_IP6_EndPoint(): p = sd.SDOption_IP6_EndPoint() # pkg type & length assert (p.type == sd._SDOption.IP6_ENDPOINT_TYPE) assert (p.len == sd._SDOption.IP6_ENDPOINT_LEN) # Payload guess p_option = sd._SDOption() assert (p_option.guess_payload_class(bytes(p)) == sd.SDOption_IP6_EndPoint)
def test_08_SDOption_IP6_Multicast(self): p = sd.SDOption_IP6_Multicast() # pkg type & length self.assertTrue(p.type == sd._SDOption.IP6_MCAST_TYPE) self.assertTrue(p.len == sd._SDOption.IP6_MCAST_LEN) # Payload guess p_option = sd._SDOption() self.assertTrue( p_option.guess_payload_class(str(p)) == sd.SDOption_IP6_Multicast)
def test_07_SDOption_IP6_EndPoint(self): p = sd.SDOption_IP6_EndPoint() # pkg type & length self.assertTrue(p.type == sd._SDOption.IP6_ENDPOINT_TYPE) self.assertTrue(p.len == sd._SDOption.IP6_ENDPOINT_LEN) # Payload guess p_option = sd._SDOption() self.assertTrue( p_option.guess_payload_class(str(p)) == sd.SDOption_IP6_EndPoint)
def test_08_SDOption_IP6_Multicast(): p = sd.SDOption_IP6_Multicast() # pkg type & length assert (p.type == sd._SDOption.IP6_MCAST_TYPE) assert (p.len == sd._SDOption.IP6_MCAST_LEN) # Payload guess p_option = sd._SDOption() assert (p_option.guess_payload_class( bytes(p)) == sd.SDOption_IP6_Multicast)
def test_03_SDOption_LoadBalance(): p = sd.SDOption_LoadBalance() # pkg type & lengths (static and overall) assert (p.type == sd._SDOption.LOADBALANCE_TYPE) assert (p.len == sd._SDOption.LOADBALANCE_LEN) assert (len(binascii.hexlify(bytes(p))) / 2 == sd._SDOption.LOADBALANCE_OVERALL_LEN) # Payload guess p_option = sd._SDOption() assert (p_option.guess_payload_class(bytes(p)) == sd.SDOption_LoadBalance)
def test_02_SDOption_Config(): p = sd.SDOption_Config() # pkg type assert (p.type == sd._SDOption.CFG_TYPE) # length without payload assert (len(binascii.hexlify(bytes(p))) / 2 == sd._SDOption.CFG_OVERALL_LEN) # add payload and check length p.cfg_str = "5abc=x7def=1230" assert (binascii.hexlify(bytes(p)) == b'00100100' + binascii.hexlify(b'5abc=x7def=1230')) # Payload guess p_option = sd._SDOption() assert (p_option.guess_payload_class(bytes(p)) == sd.SDOption_Config)
def test_02_SDOption_Config(self): p = sd.SDOption_Config() # pkg type self.assertTrue(p.type == sd._SDOption.CFG_TYPE) # length without payload self.assertTrue( len(binascii.hexlify(str(p))) / 2 == sd._SDOption.CFG_OVERALL_LEN) # add payload and check length p.cfg_str = "5abc=x7def=1230" self.assertTrue( binascii.hexlify(str(p)) == "00100100" + binascii.hexlify("5abc=x7def=1230")) # Payload guess p_option = sd._SDOption() self.assertTrue( p_option.guess_payload_class(str(p)) == sd.SDOption_Config)