Ejemplo n.º 1
0
def setUp(test):
    placefulSetUp()
    setup.getIntegrationTestZCML()
    app = AppStub()
    app['persons'] = BTreeContainer()
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 2
0
def setUp(test):
    setup.placefulSetUp()
    zcml = stsetup.getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    app['persons'] = BTreeContainer()

    from schooltool.term.term import getTermContainer
    from schooltool.term.interfaces import ITermContainer
    from schooltool.schoolyear.schoolyear import getSchoolYearContainer
    provideAdapter(getTermContainer, [Interface], ITermContainer)
    provideAdapter(getSchoolYearContainer)

    from schooltool.group.group import GroupContainer, Group
    groups = app['groups'] = GroupContainer()
    provideAdapter(lambda context: groups,
                   adapts=[ISchoolToolApplication],
                   provides=IGroupContainer)
    groups['teachers'] = Group('Teachers')
    groups['students'] = Group('Students')

    from zope.annotation.interfaces import IAnnotatable
    from schooltool.relationship.interfaces import IRelationshipLinks
    from schooltool.relationship.annotatable import getRelationshipLinks
    provideAdapter(getRelationshipLinks, [IAnnotatable], IRelationshipLinks)

    from schooltool.app.cal import getCalendar
    from schooltool.app.interfaces import ISchoolToolCalendar
    from schooltool.person.interfaces import IPerson
    provideAdapter(getCalendar, [IPerson], ISchoolToolCalendar)
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 3
0
def setUp(test):
    setup.placefulSetUp()
    zcml = stsetup.getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    app['persons'] = BTreeContainer()

    from schooltool.term.term import getTermContainer
    from schooltool.term.interfaces import ITermContainer
    from schooltool.schoolyear.schoolyear import getSchoolYearContainer
    provideAdapter(getTermContainer, [Interface], ITermContainer)
    provideAdapter(getSchoolYearContainer)

    from schooltool.group.group import GroupContainer, Group
    groups = app['groups'] = GroupContainer()
    provideAdapter(lambda context: groups,
                   adapts=[ISchoolToolApplication],
                   provides=IGroupContainer)
    groups['teachers'] = Group('Teachers')
    groups['students'] = Group('Students')

    from zope.annotation.interfaces import IAnnotatable
    from schooltool.relationship.interfaces import IRelationshipLinks
    from schooltool.relationship.annotatable import getRelationshipLinks
    provideAdapter(getRelationshipLinks, [IAnnotatable], IRelationshipLinks)

    from schooltool.app.cal import getCalendar
    from schooltool.app.interfaces import ISchoolToolCalendar
    from schooltool.person.interfaces import IPerson
    provideAdapter(getCalendar, [IPerson], ISchoolToolCalendar)
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 4
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    zcml.string('''
    <adapter
      for="schooltool.course.interfaces.ISectionContainer"
      factory="schooltool.course.browser.section.SectionNameChooser"
      provides="zope.container.interfaces.INameChooser" />
    ''')

    provideAdapter(section.getSectionContainer)
    provideAdapter(section.getTermForSection)
    provideAdapter(section.getTermForSectionContainer)
    provideAdapter(section.SectionLinkContinuinityValidationSubscriber)
    provideAdapter(getSchoolYearForTerm)
    app = AppStub()
    courses = app['schooltool.course.course'] = BTreeContainer()
    sections = app['schooltool.course.section'] = BTreeContainer()
    groups = app['schooltool.group'] = BTreeContainer()
    persons = app['persons'] = PersonContainer()
    resources = app['resources'] = BTreeContainer()
    test.globs.update({
        'app': app,
        'courses': courses,
        'sections': sections,
        'persons': persons,
        'groups': groups,
        'resources': resources,
    })
Ejemplo n.º 5
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    zcml.string('''
    <adapter
      for="schooltool.course.interfaces.ISectionContainer"
      factory="schooltool.course.browser.section.SectionNameChooser"
      provides="zope.container.interfaces.INameChooser" />
    ''')

    provideAdapter(section.getSectionContainer)
    provideAdapter(section.getTermForSection)
    provideAdapter(section.getTermForSectionContainer)
    provideAdapter(section.SectionLinkContinuinityValidationSubscriber)
    provideAdapter(getSchoolYearForTerm)
    app = AppStub()
    courses = app['schooltool.course.course'] = BTreeContainer()
    sections = app['schooltool.course.section'] = BTreeContainer()
    groups = app['schooltool.group'] = BTreeContainer()
    persons = app['persons'] = PersonContainer()
    resources = app['resources'] = BTreeContainer()
    test.globs.update({
        'app': app,
        'courses': courses,
        'sections': sections,
        'persons': persons,
        'groups': groups,
        'resources': resources,
        })
Ejemplo n.º 6
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    app = AppStub()
    test.globs.update({
        'app': app,
        'zcml': zcml,
    })
Ejemplo n.º 7
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    app = AppStub()
    test.globs.update({
        'app': app,
        'zcml': zcml,
    })
Ejemplo n.º 8
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    app['persons'] = BTreeContainer()
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 9
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    app['persons'] = BTreeContainer()
    test.globs.update({
        'app': app,
    })
Ejemplo n.º 10
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    populate(app)
    test.globs.update({
        'app': app,
        'zcml': zcml,
    })
    setSite()
Ejemplo n.º 11
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = AppStub()
    populate(app)
    test.globs.update({
        'app': app,
        'zcml': zcml,
    })
    setSite()
Ejemplo n.º 12
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    app = AppStub()
    persons = app['persons'] = BTreeContainer()
    courses = app['schooltool.course.course'] = BTreeContainer()
    sections = app['schooltool.course.section'] = BTreeContainer()
    groups = app['schooltool.group'] = BTreeContainer()
    test.globs.update({
        'zcml': zcml,
        'app': app,
        'persons': persons,
        'sections': sections,
        'groups': groups,
        'courses': courses,
    })
Ejemplo n.º 13
0
def setUp(test):
    setup.placefulSetUp()
    zcml = getIntegrationTestZCML()
    app = AppStub()
    persons = app['persons'] = BTreeContainer()
    courses = app['schooltool.course.course'] = BTreeContainer()
    sections = app['schooltool.course.section'] = BTreeContainer()
    groups = app['schooltool.group'] = BTreeContainer()
    test.globs.update({
        'zcml': zcml,
        'app': app,
        'persons': persons,
        'sections': sections,
        'groups': groups,
        'courses': courses,
        })
Ejemplo n.º 14
0
def docSetUp(test=None):
    zope_setup.placefulSetUp()
    zope_setup.setUpAnnotations()
    zope_setup.setUpTraversal()
    provideAdapter(getTermContainer, (Interface, ))
    provideAdapter(getSchoolYearForTerm)
    provideAdapter(getCourseContainer)
    provideAdapter(getCourseContainerForApp)
    provideAdapter(getSectionContainer)
    provideAdapter(getTermForSection)
    provideAdapter(getTermForSectionContainer)
    provideAdapter(getTimetableContainer)
    provideAdapter(getScheduleContainer)
    testing_registry.setupTimetablesComponents()

    provideAdapter(SectionNameChooser, (ISectionContainer, ))
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = test.globs['app'] = AppStub()
    app['persons'] = BTreeContainer()
Ejemplo n.º 15
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.º 16
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.º 17
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.º 18
0
def setUp(test):
    setup.placefulSetUp()
    provideAdapter(evaluation.getEvaluations, (Interface, ), IEvaluations)
    testing.fixDecimal()

    provideAdapter(activity.getSectionActivities, (ISection, ),
                   interfaces.IActivities)
    provideAdapter(activity.getCourseActivities, (ICourse, ),
                   interfaces.ICourseActivities)
    provideAdapter(activity.getCourseDeployedWorksheets, (ICourse, ),
                   interfaces.ICourseDeployedWorksheets)

    provideAdapter(gradebook.Gradebook)

    provideAdapter(category.getCategories)

    provideAdapter(stubs.SomeProductStub, (ISection, ),
                   interfaces.IExternalActivities,
                   name=u"someproduct")

    provideAdapter(stubs.ThirdPartyStub, (ISection, ),
                   interfaces.IExternalActivities,
                   name=u"thirdparty")

    classImplements(Person, IHaveEvaluations)

    provideAdapter(gradebook.getActivityScore)
    provideAdapter(gradebook.getLinkedActivityScore)
    provideAdapter(gradebook.getWorksheetAverageScore)

    provideUtility(stubs.DateManagerStub(), IDateManager, '')
    zcml = getIntegrationTestZCML()
    zcml.include('schooltool.schoolyear', file='schoolyear.zcml')
    app = test.globs['app'] = AppStub()
    app['persons'] = BTreeContainer()
    app['courses'] = BTreeContainer()
    app['sections'] = BTreeContainer()