~launchpad-pqm/launchpad/devel

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
= Editing poll options =

Changing the poll options detail is not possible if you are not one of the
team's administrators:

    >>> user_browser.open('http://launchpad.dev/~ubuntu-team/+polls')
    >>> user_browser.getLink('A public poll that never closes').click()
    >>> user_browser.url
    'http://launchpad.dev/~ubuntu-team/+poll/never-closes4'
    >>> print extract_text(find_tag_by_id(user_browser.contents, 'options'))
    Name        Title       Active
    OptionA     OptionA     Yes
    ...
    >>> user_browser.getLink('[Edit]')
    Traceback (most recent call last):
    ...
    LinkNotFoundError

And when the poll already started, administrators cannot change the options
either:

    # Need to craft the URL manually because there's no link to it -- the
    # option can't be changed, after all.
    >>> browser = setupBrowser(
    ...     auth='Basic jeff.waugh@ubuntulinux.com:jdub')
    >>> browser.open('http://launchpad.dev/~ubuntu-team/+poll/never-closes4/'
    ...              '+option/20')
    >>> print "\n".join(get_feedback_messages(browser.contents))
    You can’t edit any options because the poll is already open.

Since Jeff is an administrator of ubuntu-team and we have a poll that hasn't
been opened yet, he should be able to edit its options.

    >>> browser.open('http://launchpad.dev/~ubuntu-team/+polls')
    >>> browser.getLink('A public poll that has not opened yet').click()
    >>> browser.url
    'http://launchpad.dev/~ubuntu-team/+poll/not-yet-opened'

    >>> browser.getLink('[Edit]').click()
    >>> browser.url
    'http://launchpad.dev/~ubuntu-team/+poll/not-yet-opened/+option/...'

    >>> browser.getControl('Name').value
    'OptionX'
    >>> browser.getControl('Title').value
    'OptionX'
    >>> browser.getControl('Name').value = 'option-z'
    >>> browser.getControl('Title').value = 'Option Z'
    >>> browser.getControl('Save').click()

    >>> browser.url
    'http://launchpad.dev/~ubuntu-team/+poll/not-yet-opened'
    >>> print find_portlet(browser.contents, 'Voting options').renderContents()
    <BLANKLINE>
    <h2>Voting options</h2>
    ...
    ...option-z...
    ...