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
|
== Feeds do not display private bugs ==
Feeds never contain private bugs, as we are serving feeds over HTTP.
First, set all the bugs to private.
>>> from zope.security.interfaces import Unauthorized
>>> from BeautifulSoup import BeautifulStoneSoup as BSS
>>> from lp.bugs.model.bug import Bug
>>> bugs = Bug.select()
>>> for bug in bugs:
... bug.private = True
>>> from lp.services.database.sqlbase import flush_database_updates
>>> flush_database_updates()
There should be zero entries in these feeds, since all the bugs are private.
>>> browser.open('http://feeds.launchpad.dev/jokosher/latest-bugs.atom')
>>> BSS(browser.contents)('entry')
[]
>>> browser.open('http://feeds.launchpad.dev/mozilla/latest-bugs.atom')
>>> BSS(browser.contents)('entry')
[]
>>> browser.open('http://feeds.launchpad.dev/~name16/latest-bugs.atom')
>>> BSS(browser.contents)('entry')
[]
>>> browser.open('http://feeds.launchpad.dev/~simple-team/latest-bugs.atom')
>>> BSS(browser.contents)('entry')
[]
>>> from lp.services.config import config
>>> bug_search_feed_data = """
... [launchpad]
... is_bug_search_feed_active: True
... """
>>> config.push('bug_search_feed_data', bug_search_feed_data)
>>> browser.open('http://feeds.launchpad.dev/bugs/+bugs.atom?'
... 'field.searchtext=&search=Search+Bug+Reports&'
... 'field.scope=all&field.scope.target=')
>>> BSS(browser.contents)('entry')
[]
There should be just one <tr> elements for the table header in
these HTML feeds, since all the bugs are private.
>>> browser.open('http://feeds.launchpad.dev/jokosher/latest-bugs.html')
>>> len(BSS(browser.contents)('tr'))
1
>>> print extract_text(BSS(browser.contents)('tr')[0])
Bugs in Jokosher
>>> browser.open('http://feeds.launchpad.dev/mozilla/latest-bugs.html')
>>> len(BSS(browser.contents)('tr'))
1
>>> print extract_text(BSS(browser.contents)('tr')[0])
Bugs in The Mozilla Project
>>> browser.open('http://feeds.launchpad.dev/~name16/latest-bugs.html')
>>> len(BSS(browser.contents)('tr'))
1
>>> print extract_text(BSS(browser.contents)('tr')[0])
Bugs for Foo Bar
>>> browser.open('http://feeds.launchpad.dev/~simple-team/latest-bugs.html')
>>> len(BSS(browser.contents)('tr'))
1
>>> print extract_text(BSS(browser.contents)('tr')[0])
Bugs for Simple Team
>>> browser.open('http://feeds.launchpad.dev/bugs/+bugs.html?'
... 'field.searchtext=&search=Search+Bug+Reports&'
... 'field.scope=all&field.scope.target=')
>>> len(BSS(browser.contents)('tr'))
1
>>> try:
... browser.open('http://feeds.launchpad.dev/bugs/1/bug.html')
... except Unauthorized:
... print "Shouldn't raise Unauthorized exception"
>>> BSS(browser.contents)('entry')
[]
Revert configuration change after tests are finished.
>>> config_data = config.pop('bug_search_feed_data')
|