Beispiel #1
0
 def test_unpack_error_code_too_short(self):
     data = unhexlify("000004")
     with self.assertRaises(ValueError) as cm:
         stun.unpack_error_code(data)
     self.assertEqual(str(cm.exception),
                      "STUN error code is less than 4 bytes")
Beispiel #2
0
 def test_unpack_error_code(self):
     data = unhexlify("00000457526f6c6520436f6e666c696374")
     code, reason = stun.unpack_error_code(data)
     self.assertEqual(code, 487)
     self.assertEqual(reason, "Role Conflict")