예제 #1
0
    def test_with_dict(self, api):
        model = api.model('Test', {
            'name': fields.ClassName(),
        })

        data = api.marshal({}, model)
        assert data == {'name': 'object'}
예제 #2
0
    def test_default_output_classname(self, api):
        model = api.model('Test', {
            'name': fields.ClassName(),
        })

        class FakeClass(object):
            pass

        data = api.marshal(FakeClass(), model)
        assert data == {'name': 'FakeClass'}
예제 #3
0
    def test_output_dash(self, api):
        model = api.model('Test', {
            'name': fields.ClassName(dash=True),
        })

        class FakeClass(object):
            pass

        data = api.marshal(FakeClass(), model)
        assert data == {'name': 'fake_class'}
예제 #4
0
 def test_simple_string_field(self):
     field = fields.ClassName()
     assert not field.required
     assert not field.discriminator
     assert field.__schema__ == {'type': 'string'}