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
|
We should now see the various distro's, projects and products that the
group has been assigned as the translator for.
>>> browser.open(
... 'http://translations.launchpad.dev/+groups/polyglot')
>>> print browser.url
http://translations.launchpad.dev/+groups/polyglot
>>> def find_projects_portlet(browser):
... """Find the portlet with projects/distros this group works with.
... """
... return find_tag_by_id(browser.contents, "related-projects")
>>> portlet = find_projects_portlet(browser)
>>> for link in portlet.findAll('a'):
... print '%s: %s' % (link.find(text=True), link['href'])
Ubuntu: http://launchpad.dev/ubuntu
GNOME: http://launchpad.dev/gnome
NetApplet: http://launchpad.dev/netapplet
If we disable some of these projects...
>>> admin_browser.open("http://launchpad.dev/gnome/+review")
>>> admin_browser.getControl("Active").click()
>>> admin_browser.getControl("Change").click()
>>> admin_browser.url
'http://launchpad.dev/projectgroups'
# Unlink the source packages so the project can be deactivated.
>>> from zope.component import getUtility
>>> from lp.registry.interfaces.product import IProductSet
>>> from lp.testing import unlink_source_packages
>>> login('admin@canonical.com')
>>> unlink_source_packages(getUtility(IProductSet).getByName('netapplet'))
>>> logout()
>>> admin_browser.open("http://launchpad.dev/netapplet/+admin")
>>> admin_browser.getControl("Active").click()
>>> admin_browser.getControl("Change").click()
>>> admin_browser.url
'http://launchpad.dev/projects'
They disappear from the listing:
>>> browser.open(
... 'http://translations.launchpad.dev/+groups/polyglot')
>>> print browser.url
http://translations.launchpad.dev/+groups/polyglot
>>> portlet = find_projects_portlet(browser)
>>> for link in portlet.findAll('a'):
... print '%s: %s' % (link.string, link['href'])
Ubuntu: http://launchpad.dev/ubuntu
Let's undo this so we don't get in trouble with other tests in this
story!
>>> admin_browser.open("http://launchpad.dev/gnome/+review")
>>> admin_browser.getControl("Active").click()
>>> admin_browser.getControl("Change").click()
>>> admin_browser.open("http://launchpad.dev/netapplet/+admin")
>>> admin_browser.getControl("Active").click()
>>> admin_browser.getControl("Change").click()
|