Пример #1
0
    def test_inherit(self):
        api = Namespace('test')
        parent = api.model('Parent', {})
        api.inherit('Child', parent, {})

        assert 'Parent' in api.models
        assert 'Child' in api.models
Пример #2
0
    def test_inherit_from_multiple_parents(self):
        api = Namespace('test')
        grand_parent = api.model('GrandParent', {})
        parent = api.model('Parent', {})
        api.inherit('Child', grand_parent, parent, {})

        assert 'GrandParent' in api.models
        assert 'Parent' in api.models
        assert 'Child' in api.models
Пример #3
0
    def test_inherit(self):
        authorizations = {
            'apikey': {
                'type': 'apiKey',
                'in': 'header',
                'name': 'X-API-KEY'
            }
        }
        api = Namespace('test', authorizations=authorizations)
        parent = api.model('Parent', {})
        api.inherit('Child', parent, {})

        assert 'Parent' in api.models
        assert 'Child' in api.models
        assert api.authorizations == authorizations