Test for sections being removed properly when term is gone
==========================================================

A manager logs in

    >>> manager = Browser('manager', 'schooltool')

Sets the time

    >>> manager.open('http://localhost/time')
    >>> manager.getControl('Today').value = "2005-02-15"
    >>> manager.getControl('Apply').click()

    >>> 'Data successfully updated.' in manager.contents
    True

And creates a new school year:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getLink('New School Year').click()
    >>> manager.getControl('Title').value = '2005-2006'
    >>> manager.getControl('First day').value = '2005-09-01'
    >>> manager.getControl('Last day').value = '2006-07-15'
    >>> manager.getControl('Add').click()

A couple of terms

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.addTerm('Term 1', '2005-09-01', '2005-12-31', '2005-2006')
    >>> setup.addTerm('Term 2', '2006-01-01', '2006-07-15', '2005-2006')

A course

    >>> setup.addCourse("History", "2005-2006")

And two sections

    >>> setup.addSection("History", "2005-2006", "Term 1", instructors=["SchoolTool"])
    >>> setup.addSection("History", "2005-2006", "Term 2", instructors=["SchoolTool"])

Now let's delete one term:

    >>> manager.getLink("2005-2006").click()
    >>> manager.getControl(name="delete.term-1").value = True
    >>> manager.getControl("Delete").click()
    >>> manager.getControl("Confirm").click()

The section should not be in the section list of the manager user anymore:

    >>> manager.getLink('Home').click()
    >>> for block in analyze.queryHTML("//div[contains(@class, 'info-block') and not(contains(@class, 'person-groups'))]", manager.contents): print block
    <div class="info-block">
       <h5>Details</h5>
    </div>
    <div class="info-block clearfix">
      <h3>Sections Taught</h3>
      <div class="tree_list">
        <ul><li>
          <a href="http://localhost/schoolyears/2005-2006" title="2005-2006">2005-2006</a>
          <ul><li>
            <a href="http://localhost/schoolyears/2005-2006/term-2" title="Term 2">Term 2</a>
            <ul><li>
              <a class="leaf_url" href="http://localhost/schoolyears/2005-2006/term-2/sections/1" title="History -- History (1)">History -- History (1)</a>
            </li>
            </ul></li>
          </ul></li>
        </ul></div>
    </div>

if we delete the school year

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getControl(name='delete.2005-2006').value = True
    >>> manager.getControl('Delete').click()
    >>> manager.getControl('Confirm').click()

the other section should disappear as well (actually the whole
sections taught secion is gone)

    >>> manager.getLink('Home').click()
    >>> for block in analyze.queryHTML("//div[@class='info-block']", manager.contents): print block
    <div class="info-block">
       <h5>Details</h5>
    </div>
