def testToJsonAndFromJson(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonStr = protocol.toJson(obj) obj2 = protocol.fromJson(jsonStr, clazz) self.assertTrue(obj, obj2)
def testToJsonAndFromJson(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonStr = protocol.toJson(obj) obj2 = protocol.fromJson(jsonStr, clazz) self.assertTrue(obj, obj2)
def testToProtobufStringAndFromProtobufString(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() pbStr = protocol.toProtobufString(obj) obj2 = protocol.fromProtobufString(pbStr, clazz) self.assertTrue(obj, obj2)
def testGetProtocolClasses(self): classes = protocol.getProtocolClasses() self.assertGreater(len(classes), 0) for clazz in classes: self.assertTrue(issubclass(clazz, message.Message))
def testValidate(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonStr = protocol.toJson(obj) protocol.validate(jsonStr, clazz)
def testToJsonDict(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonDict = protocol.toJsonDict(obj) self.assertIsInstance(jsonDict, dict)
def testGetValueListName(self): for clazz in protocol.getProtocolClasses(): if len(clazz.DESCRIPTOR.fields_by_number) > 0: self.assertIsInstance(protocol.getValueListName(clazz), str)
def testGetValueListName(self): for clazz in protocol.getProtocolClasses(): self.assertIsInstance(protocol.getValueListName(clazz), str)
def testGetProtocolClasses(self): classes = protocol.getProtocolClasses() self.assertGreater(len(classes), 0) for clazz in classes: self.assertTrue(issubclass(clazz, message.Message))
def testValidate(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonStr = protocol.toJson(obj) protocol.validate(jsonStr, clazz)
def testToJsonDict(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() jsonDict = protocol.toJsonDict(obj) self.assertIsInstance(jsonDict, dict)
def testGetValueListName(self): for clazz in protocol.getProtocolClasses(): self.assertIsInstance(protocol.getValueListName(clazz), str)
def testValidateProtobufString(self): classes = protocol.getProtocolClasses() for clazz in classes: obj = clazz() pbStr = protocol.toProtobufString(obj) protocol.validateProtobufString(pbStr, clazz)
def testGetValueListName(self): for clazz in protocol.getProtocolClasses(): if len(clazz.DESCRIPTOR.fields_by_number) > 0: self.assertIsInstance(protocol.getValueListName(clazz), str)