Beispiel #1
0
 def test_good_model(self):
     schema = to_schema(Conference)
     schema.deserialize({
         'id': 1,
         'name': 'Conf 1',
         'description': 'foo',
         'is_active': True
     })
Beispiel #2
0
 def test_good_model(self):
     schema = to_schema(Conference)
     schema.deserialize({
         'id': 1
         , 'name': 'Conf 1'
         , 'description': 'foo'
         , 'is_active': True
     })
Beispiel #3
0
 def test_badg_length(self):
     schema = to_schema(Conference)
     had_exception = False
     try:
         schema.deserialize({
             'id': 1,
             'name': '12345678910111213',
             'description': 'foo',
             'is_active': True
         })
     except colander.Invalid, e:
         had_exception = True
         errors = e.asdict()
         assert errors['name'] == 'Longer than maximum length 10'
Beispiel #4
0
    def test_bad_model(self):
        schema = to_schema(Conference)

        had_exception = False

        try:
            schema.deserialize({})
        except colander.Invalid, e:
            errors = e.asdict()
            had_exception = True
            assert errors['id'] == 'Required'
            assert errors['name'] == 'Required'
            assert errors['is_active'] == 'Required'
            assert not 'description' in errors
Beispiel #5
0
 def test_badg_length(self):
     schema = to_schema(Conference)
     had_exception = False
     try:
         schema.deserialize({
             'id': 1
             , 'name': '12345678910111213'
             , 'description': 'foo'
             , 'is_active': True
         })
     except colander.Invalid, e:
         had_exception = True
         errors = e.asdict()
         assert errors['name'] == 'Longer than maximum length 10'
Beispiel #6
0
    def test_bad_model(self):
        schema = to_schema(Conference)

        had_exception = False

        try:
            schema.deserialize({})
        except colander.Invalid, e:
            errors = e.asdict()
            had_exception = True
            assert errors['id'] == 'Required'
            assert errors['name'] == 'Required'
            assert errors['is_active'] == 'Required'
            assert not 'description' in errors