Exemplo n.º 1
0
 def test_missing_required(self):
     instance = self.mod.Person()
     pbtool.fill(instance, {
         'name': 'Hullo',
         'email': '*****@*****.**',
         'phone': []
     })
     self.assertRaises(Exception, instance.SerializeToString)
Exemplo n.º 2
0
 def test(self):
     instance = self.mod.Person()
     pbtool.fill(instance, {
         'name': 'Hullo',
         'email': '*****@*****.**',
         'id': 999,
         'phone': []
     })
     instance.SerializeToString()
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
 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()
Exemplo n.º 5
0
 def test_missing_optional(self):
     instance = self.mod.Person()
     pbtool.fill(instance, {'name': 'Hullo', 'id': 999, 'phone': []})
     instance.SerializeToString()