This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/intervention/browser/ftests/independent_activities.txt is in python-schooltool.intervention 2.7.1-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
======================
Independent Activities
======================

We need to get data from the gradebook in two views, the student intervention
center and the section interventions view, but we don't want our package
to be dependent on schooltool.gradebook.  If schooltool.gradebook happens to
be in the build, we want to get data from it, but if it is not, we can't
have it fail while looking for a package that is not there.

To accomplish this, schooltool core defines an interface called
IIndependentActivities and schooltool.gradebook registers an adapter
that adapts ISection to IIndependentActivities, returning IActivities(section).
When there is no schooltool.gradebook present, there will be no one who
supplies that adapter, so our code must handle that case as well.

To test this we supply an adapter for testing only that returns a stubbed out
equivalent of IActivities(section) that the views will use, but only if the
section title is a special title.  Otherwise, out test adapter returns None,
simulating the case where no schooltool.gradebook package is available.

First we need to set up the school.

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.setUpBasicSchool()
    >>> manager = setup.logIn('manager', 'schooltool')

We'll create a teacher and a student.

    >>> from schooltool.intervention.browser.ftests import ftests
    >>> ftests.addPerson('Teacher1', 'Teacher1', 'teacher1', 'pwd')
    >>> ftests.addPerson('Student1', 'Student1', 'student1', 'pwd')

Next. we'll create two sections, one with the special title and one without.
In both cases our teacher will teach the student.

    >>> ftests.addCourseSectionMembers('course1', 'section1', ['Teacher1'],
    ...     ['Student1'])
    >>> ftests.addCourseSectionMembers('course2', 'special title', ['Teacher1'],
    ...     ['Student1'])

First we'll visit the first section.  Note that the Message tab is active, and
there is only one more tab, Goals.  This section does not have the special
title, so our adpater stub will return None, simulating what happens when no
schooltool.gradebook is in the build.

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Spring').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink('section1').click()
    >>> manager.getLink('Interventions').click()
    >>> manager.printQuery("id('content-body')//div[@class='tabmenu']/p")
    <p>Messages</p>
    >>> manager.printQuery("id('content-body')//div[@class='tabmenu']/a")
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/1/interventions.html?TAB=goals">Goals</a>
    >>> manager.printQuery("id('content-body')//div[@class='student_nav_link']/a")
    <a href="http://localhost/schooltool.interventions/2005-2006/student1/messages/allMessages.html">View Messages (0)</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/1/messages/student1/+/addMessage.html">Write New</a>

Now we'll visit the second section.  In this case our stub adapter will pretend
that there is a schooltool.gradebook package and that this section has some
worksheets, one deployed and one not.  There is a third tab now, Report Sheets,
and it has the deployed worksheet as a link.  Our stub absoluteURL adapter
just returns the worksheet's title as its url, the rest being added on in the
view code.

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Spring').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink('special title').click()
    >>> manager.getLink('Interventions').click()
    >>> manager.printQuery("id('content-body')//div[@class='tabmenu']/p")
    <p>Report Sheets</p>
    >>> manager.printQuery("id('content-body')//div[@class='tabmenu']/a")
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/2/interventions.html?TAB=messages">Messages</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/2/interventions.html?TAB=goals">Goals</a>
    >>> manager.printQuery("id('content-body')//div[@class='student_nav_link']/a")
    <a href="Worksheet1/gradebook/student1?nexturl=http://localhost/schoolyears/2005-2006/spring/sections/2/@@interventions.html">Worksheet1</a>

Finally, we'll visit the student intervention center and check that the second
section's first worksheet (the deployed one) is listed in the report sheets
fieldset, and no others are.

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Persons').click()
    >>> manager.getLink('Student1').click()
    >>> manager.getLink('Intervention Center').click()
    >>> manager.printQuery("id('content-body')//fieldset[3]//li/a")
    <a href="Worksheet1/gradebook/student1/view.html">Worksheet1 for course2 - special title</a>