Ejemplo n.º 1
0
def setUpIntegration(test):
    setup.placefulSetUp()
    # Workaround: _clear actually sets the Zope's vocabulary registry and
    #             is called on zope.app.schema.vocabularies import (during
    #             zcml parsing, for example).  When running multiple tests
    #             this ingenious idea fails, so we call it manually.
    from zope.app.schema import vocabulary
    vocabulary._clear()

    zcml = ZCMLWrapper()
    zcml.setUp(
        namespaces={"": "http://namespaces.zope.org/zope"},
        i18n_domain='schooltool')
    zcml.include('schooltool.common', file='zcmlfiles.zcml')
    # We define the default pemissions here, because though widely used,
    # they are currently mangled with other stuff in schooltool.common
    zcml.string('''
      <permission id="schooltool.view" title="View" />
      <permission id="schooltool.edit" title="Edit Info" />
    ''')

    zcml.include('zope.intid')
    zcml.string('''
      <utility
        factory="zope.intid.IntIds"
        provides="zope.intid.interfaces.IIntIds"
      />
      <adapter
          for="persistent.interfaces.IPersistent"
          factory="schooltool.testing.stubs.KeyReferenceStub"
          trusted="y"
          />
    ''')

    zcml.include('schooltool.level', file='level.zcml')
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    zcml.include('schooltool.relationship', file='relationship.zcml')
    provideAdapter(LocationCopyHook)

    root = rootFolder()
    root['app'] = provideApplicationStub()
    setup.createSiteManager(root['app'], setsite=True)
    test.globs.update({
        'zcml': zcml,
        'CourseStub': CourseStub,
        'getRelatedObjects': getRelatedObjects,
        'provideAdapter': provideStubAdapter,
        'unregisterAdapter': unregisterStubAdapter,
        })
Ejemplo n.º 2
0
def setUpIntegration(test):
    setup.placefulSetUp()
    # Workaround: _clear actually sets the Zope's vocabulary registry and
    #             is called on zope.app.schema.vocabularies import (during
    #             zcml parsing, for example).  When running multiple tests
    #             this ingenious idea fails, so we call it manually.
    from zope.app.schema import vocabulary
    vocabulary._clear()

    zcml = ZCMLWrapper()
    zcml.setUp(namespaces={"": "http://namespaces.zope.org/zope"},
               i18n_domain='schooltool')
    zcml.include('schooltool.common', file='zcmlfiles.zcml')
    # We define the default pemissions here, because though widely used,
    # they are currently mangled with other stuff in schooltool.common
    zcml.string('''
      <permission id="schooltool.view" title="View" />
      <permission id="schooltool.edit" title="Edit Info" />
    ''')

    zcml.include('zope.intid')
    zcml.string('''
      <utility
        factory="zope.intid.IntIds"
        provides="zope.intid.interfaces.IIntIds"
      />
      <adapter
          for="persistent.interfaces.IPersistent"
          factory="schooltool.testing.stubs.KeyReferenceStub"
          trusted="y"
          />
    ''')

    zcml.include('schooltool.level', file='level.zcml')
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    zcml.include('schooltool.relationship', file='relationship.zcml')
    provideAdapter(LocationCopyHook)

    root = rootFolder()
    root['app'] = provideApplicationStub()
    setup.createSiteManager(root['app'], setsite=True)
    test.globs.update({
        'zcml': zcml,
        'CourseStub': CourseStub,
        'getRelatedObjects': getRelatedObjects,
        'provideAdapter': provideStubAdapter,
        'unregisterAdapter': unregisterStubAdapter,
    })
Ejemplo n.º 3
0
def setUp(test):
    setup.placefulSetUp()
    # Workaround: _clear actually sets the Zope's vocabulary registry and
    #             is called on zope.app.schema.vocabularies import (during
    #             zcml parsing, for example).  When running multiple tests
    #             this ingenious idea fails, so we call it manually.
    from zope.app.schema import vocabulary
    vocabulary._clear()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.level', file='level.zcml')
    provideAdapter(LocationCopyHook, (ILocation,))
    app = AppStub()
    app['schooltool.course.course'] = BTreeContainer()
    test.globs.update({
        'CourseStub': CourseStub,
        'getRelatedObjects': getRelatedObjects,
        'provideAdapter': provideStubAdapter,
        'unregisterAdapter': unregisterStubAdapter,
        'app': app,
        })
Ejemplo n.º 4
0
def setUp(test):
    setup.placefulSetUp()
    from z3c.form import testing
    testing.setupFormDefaults()
    from zope.app.schema import vocabulary
    vocabulary._clear()
    zcml = getIntegrationTestZCML()
    zcml.string('''
    <utility
        factory="schooltool.basicperson.vocabularies.groupVocabularyFactory"
        provides="zope.schema.interfaces.IVocabularyFactory"
        name="schooltool.basicperson.group_vocabulary" />
    <utility
        factory="schooltool.basicperson.vocabularies.advisorVocabularyFactory"
        provides="zope.schema.interfaces.IVocabularyFactory"
        name="schooltool.basicperson.advisor_vocabulary" />
    ''')
    app = AppStub()
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 5
0
def setUp(test):
    setup.placefulSetUp()
    from z3c.form import testing
    testing.setupFormDefaults()
    from zope.app.schema import vocabulary
    vocabulary._clear()
    zcml = getIntegrationTestZCML()
    zcml.string('''
    <utility
        factory="schooltool.basicperson.vocabularies.groupVocabularyFactory"
        provides="zope.schema.interfaces.IVocabularyFactory"
        name="schooltool.basicperson.group_vocabulary" />
    <utility
        factory="schooltool.basicperson.vocabularies.advisorVocabularyFactory"
        provides="zope.schema.interfaces.IVocabularyFactory"
        name="schooltool.basicperson.advisor_vocabulary" />
    ''')
    app = AppStub()
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 6
0
def setUp(test):
    setup.placefulSetUp()
    _clear()