=========================
Grading Integration Tests
=========================

The overarching requirement in this scenario is the school curriculum.  That is,
this requirement represents the work that has to be done to graduate.

First we need to set up the school itself:

  >>> from schooltool.testing import setup
  >>> school = setup.setUpSchoolToolSite()

Next we are creating the base requirement for graduation:

  >>> from schooltool.requirement import interfaces, requirement
  >>> graduation = requirement.Requirement(u'Graduation Requirements')

We want to create a course to provide some context:

  >>> from schooltool.course.course import Course
  >>> from schooltool.course.course import CourseContainer

  >>> courses = CourseContainer()
  >>> econ = courses[u'econ'] = Course()
  >>> econ.title = u'Economics'
  >>> econ.title
  u'Economics'

The course can be adapted to be a ``IRequirement``:

  >>> econ_req = interfaces.IRequirement(econ)
  >>> econ_req
  Requirement(u'Economics')

We want to indicate that Economics is part of the Graduation Requirements:

  >>> graduation[u'econ'] = econ_req
  >>> sorted(graduation.keys())
  [u'econ']

Now we'll create a section of the economics course.  It also implements
``IRequirement``:

  >>> from schooltool.course.section import Section
  >>> from schooltool.course.section import SectionContainer

  >>> sections = SectionContainer()
  >>> econ_section = Section(u"3rd Period Econ.")
  >>> sections[u'3rd-econ'] = econ_section

  >>> sec_req = interfaces.IRequirement(econ_section)
  >>> sec_req
  Requirement(u'3rd Period Econ.')

Create some people.

  >>> from schooltool.person.person import Person

  >>> student = school[u'persons'][u'jane'] = Person(u"Jane Student")
  >>> teacher = school[u'persons'][u'joe'] = Person(u"Joe Teacher")

Grab the student's ``IEvaluations`` adapter:

  >>> evals = interfaces.IEvaluations(student)
  >>> evals
  <Evaluations for <schooltool.person.person.Person object at ...>
  >>> sorted(evals.keys())
  []

The next step is to decide on a scoresystem to use for the requirements. For
simplicity's sake, let use the standard Pass/Fail system:

  >>> from schooltool.requirement.scoresystem import PassFail
  >>> pf = PassFail

We should be able to make an evaluation now:

  >>> from schooltool.requirement import evaluation
  >>> ev = evaluation.Evaluation(sec_req, pf, 'Pass', teacher)
  >>> ev.requirement
  Requirement(u'3rd Period Econ.')
  >>> ev.scoreSystem
  <GlobalDiscreteValuesScoreSystem u'Pass/Fail'>
  >>> ev.value
  'Pass'
  >>> ev.evaluator
  <schooltool.person.person.Person object at ...>

And we then attach the section evaluation to the student being evaluated:

  >>> sorted(evals.keys())
  []
  >>> ev
  <Evaluation for Requirement(u'3rd Period Econ.'), value='Pass'>

We need to do some kind of setup to get this working.

  >>> name = evals.addEvaluation(ev)
  >>> sorted(evals.values())
  [<Evaluation for Requirement(u'3rd Period Econ.'), value='Pass'>]
