


from Ft.Ods import Database
from Ft.Ods.StorageManager.Adapters import Constants
import test_metaobject, test_metadata_util

def Test(tester,db,klass):


    test_metaobject.Test(tester,db,klass)

    tester.startGroup("Type Interface on %s Driver %s" % (klass.__name__,tester.test_data['driver']))

    def GetCollection(db,values):
        from Ft.Ods.MetaData import Collection
        from Ft.Ods.MetaData import CollectionKind
        c = Collection.Collection(db,None,collection_kind=CollectionKind.ck_list)
        c.name='col1'
        return c
    test_metadata_util.test_form_drop(tester,db,klass,'collections',GetCollection,nSided=1)
    def GetDictionary(db,values):
        from Ft.Ods.MetaData import Dictionary
        d = Dictionary.Dictionary(db,None)
        d.name='dict1'
        return d
    test_metadata_util.test_form_drop(tester,db,klass,'dictionaries',GetDictionary,nSided=1)
    def GetSpecifier(db,values):
        from Ft.Ods.MetaData import UnionCase
        u = UnionCase.UnionCase(db,None)
        u.name='uc1'
        return u
    test_metadata_util.test_form_drop(tester,db,klass,'specifiers',GetSpecifier,nSided=1)
    def GetUnion(db,values):
        from Ft.Ods.MetaData import Union
        u = Union.Union(db,None)
        u.name='u1'
        return u
    test_metadata_util.test_form_drop(tester,db,klass,'unions',GetUnion,nSided=1)
    def GetOperation(db,values):
        from Ft.Ods.MetaData import Operation
        u = Operation.Operation(db,None)
        u.name='u1'
        return u
    test_metadata_util.test_form_drop(tester,db,klass,'operations',GetOperation,nSided=1)
    def GetProperty(db,values):
        from Ft.Ods.MetaData import Attribute
        a = Attribute.Attribute(db,None)
        a.name='a1'
        return a
    test_metadata_util.test_form_drop(tester,db,klass,'properties',GetProperty,nSided=1)
    def GetConstant(db,values):
        from Ft.Ods.MetaData import Constant
        c = Constant.Constant(db,None)
        c.name='const1'
        return c
    test_metadata_util.test_form_drop(tester,db,klass,'constants',GetConstant,nSided=1)
    def GetTypeDef(db,values):
        from Ft.Ods.MetaData import TypeDefinition
        t = TypeDefinition.TypeDefinition(db,None)
        t.name='td1'
        return t
    test_metadata_util.test_form_drop(tester,db,klass,'type_defs',GetTypeDef,nSided=1)

    tester.groupDone()

