コード例 #1
0
ファイル: test_fields.py プロジェクト: ziirish/flask-restx
    def test_with_dict(self, api):
        model = api.model('Test', {
            'name': fields.ClassName(),
        })

        data = api.marshal({}, model)
        assert data == {'name': 'object'}
コード例 #2
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
    def test_with_dict(self, api):
        model = api.model("Test", {
            "name": fields.ClassName(),
        })

        data = api.marshal({}, model)
        assert data == {"name": "object"}
コード例 #3
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
    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
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
    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"}
コード例 #5
0
ファイル: test_fields.py プロジェクト: ziirish/flask-restx
    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'}
コード例 #6
0
ファイル: test_fields.py プロジェクト: ziirish/flask-restx
    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'}
コード例 #7
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
 def test_simple_string_field(self):
     field = fields.ClassName()
     assert not field.required
     assert not field.discriminator
     assert field.__schema__ == {"type": "string"}