def test_missing_required(self): instance = self.mod.Person() pbtool.fill(instance, { 'name': 'Hullo', 'email': '*****@*****.**', 'phone': [] }) self.assertRaises(Exception, instance.SerializeToString)
def test(self): instance = self.mod.Person() pbtool.fill(instance, { 'name': 'Hullo', 'email': '*****@*****.**', 'id': 999, 'phone': [] }) instance.SerializeToString()
def test_repeated(self): instance = self.mod.Person() pbtool.fill( instance, { 'name': 'Hullo', 'id': 999, 'phone': [{ 'number': '1-800-stuff' }, { 'number': '1-800-moar-stuff' }] }) instance.SerializeToString()
def test_enum(self): instance = self.mod.Person() pbtool.fill( instance, { 'name': 'Hullo', 'id': 999, 'phone': [{ 'number': '1-800-stuff', 'type': 'WORK' }, { 'number': '1-800-stuff', 'type': 'MOBILE' }] }) instance.SerializeToString()
def test_missing_optional(self): instance = self.mod.Person() pbtool.fill(instance, {'name': 'Hullo', 'id': 999, 'phone': []}) instance.SerializeToString()