Test for adding messages for a person
=====================================

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

Add a section:

    >>> manager.ui.schoolyear.add('2014', '2014-01-01', '2014-12-31')
    >>> manager.ui.term.add('2014', '2014', '2014-01-01', '2014-12-31')
    >>> manager.ui.course.add('2014', 'Math')
    >>> manager.ui.section.add('2014', '2014', 'Math')

Add a some people:

    >>> manager.ui.person.add('Jeffrey', 'Elkner', 'jeffrey', 'schooltool')
    >>> manager.ui.person.add('Tom', 'Hoffman', 'tom', 'schooltool')
    >>> manager.ui.person.add('Camila', 'Cerna', 'camila', 'schooltool')

Make Tom the advisor for Camila:

    >>> manager.ui.person.advisors.add('camila', ['tom'])

Populate the section:

    >>> manager.ui.section.instructors.add('2014', '2014', 'Math (1)',
    ...                                    ['jeffrey'])
    >>> manager.ui.section.students.add('2014', '2014', 'Math (1)',
    ...                                 ['camila'])

Log in as the teacher of the section:

    >>> teacher = browsers.teacher
    >>> teacher.ui.login('jeffrey', 'schooltool')

And add a message for the student:

    >>> teacher.query.link('Intervention').click()
    >>> teacher.query.link('Students').click()
    >>> teacher.query.link('Camila').click()
    >>> teacher.query.css('a[title="Add Message"]').click()
    >>> title = 'Camila was absent today'
    >>> body = "I don't know where she was\nTell her to call me"
    >>> teacher.query.id('form-widgets-subject').ui.set_value(title)
    >>> teacher.query.id('form-widgets-body').ui.set_value(body)
    >>> teacher.query.id('form-buttons-add').click()

Check the message:

    >>> teacher.query.link('Camila was absent today').click()
    >>> for tr in teacher.query_all.tag('tr'):
    ...     tds = tr.query_all.tag('td')
    ...     print tds[0].text, tds[1].text
    From: Jeffrey Elkner
    To: Tom Hoffman
    Date: .../.../...
    Subject: Camila was absent today
    >>> for p in teacher.query_all.css('.container p'):
    ...     print p.text
    I don't know where she was
    Tell her to call me
