~launchpad-pqm/launchpad/devel

4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
1
= Editing FAQs =
2
3
It is possible to modify the title, keywords and content of an existing
4
FAQ. To do this, the user goes to the FAQ that he wants to modify and
4319.2.51 by Francis J. Lacoste
Typos.
5
clicks the 'Edit FAQ' action.
4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
6
7
That action is only available to project owners and answer contacts.
8
That's why the link doesn't appear for the anonymous user nor
9
No Privileges Person:
10
4319.2.63 by Francis J. Lacoste
Show browser title in unicode.
11
    >>> from canonical.launchpad.helpers import backslashreplace
4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
12
    >>> anon_browser.open('http://answers.launchpad.dev/firefox/+faq/7')
4319.2.63 by Francis J. Lacoste
Show browser title in unicode.
13
    >>> print backslashreplace(anon_browser.title)
9826.4.1 by Curtis Hovey
Added FAQ Breadcrumb adapter to fix crumbs and title. Fixed the heading.
14
    FAQ #7 : Questions : Mozilla Firefox
4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
15
16
    >>> anon_browser.getLink('Edit FAQ')
17
    Traceback (most recent call last):
18
    ...
19
    LinkNotFoundError
20
21
    >>> user_browser.open('http://answers.launchpad.dev/firefox/+faq/7')
22
    >>> user_browser.getLink('Edit FAQ')
23
    Traceback (most recent call last):
24
    ...
25
    LinkNotFoundError
26
27
Even trying to access the link directly will fail:
28
29
    >>> anon_browser.open(
30
    ...     'http://answers.launchpad.dev/firefox/+faq/7/+edit')
31
    Traceback (most recent call last):
32
    ...
33
    Unauthorized: ...
34
    >>> user_browser.open(
35
    ...     'http://answers.launchpad.dev/firefox/+faq/7/+edit')
36
    Traceback (most recent call last):
37
    ...
38
    Unauthorized: ...
39
40
The link is accessible to Sample Person who is the owner of the Firefox
41
project:
42
43
    >>> browser.addHeader('Authorization', 'Basic test@canonical.com:test')
44
    >>> browser.open('http://answers.launchpad.dev/firefox/+faq/7')
45
    >>> browser.getLink('Edit FAQ').click()
46
    >>> print browser.url
47
    http://answers.launchpad.dev/firefox/+faq/7/+edit
9297.2.24 by Barry Warsaw
Test repair.
48
    >>> print browser.title
9322.10.22 by Guilherme Salgado
Fix a bunch of tests and change makeBreadcrumbForRequestedPage() to use view.label before trying to look up a title in pagetitles.py
49
    Edit FAQ...
4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
50
4319.2.53 by Francis J. Lacoste
Syntax and remove use of backslashreplace.
51
The user can change the title, keywords and content fields. He then
4319.2.51 by Francis J. Lacoste
Typos.
52
clicks 'Save' to save his changes.
4319.2.50 by Francis J. Lacoste
Add +edit view on IFAQ.
53
54
    >>> print browser.getControl('Title').value
55
    How do I install Java?
56
    >>> browser.getControl('Keywords').value
57
    ''
58
    >>> print browser.getControl('Content').value
59
    Windows
60
    On Windows, ...
61
62
    >>> browser.getControl('Keywords').value = (
63
    ...     'windows ubuntu plugins extensions')
64
    >>> browser.getControl('Content').value += (
65
    ...     '\nUbuntu:\nSee https://help.ubuntu.com/community/Java\n')
66
67
    >>> browser.getControl('Save').click()
68
69
The user can see his changes on the page:
70
71
    >>> print browser.url
72
    http://answers.launchpad.dev/firefox/+faq/7
73
74
    >>> print extract_text(find_tag_by_id(browser.contents, 'faq-keywords'))
75
    Keywords: windows ubuntu plugins extensions
76
77
    >>> print extract_text(find_tag_by_id(browser.contents, 'faq-content'))
78
    Windows
79
    On Windows,...
80
    Ubuntu: See https://help.ubuntu.com/community/Java
81
82
The 'Last updated by' field in the 'Lifecycle' portlet is updated
83
with the name of the user who made the last modification:
84
9861.5.9 by Curtis Hovey
Updated tests to verify FAQ information.
85
    >>> print extract_text(find_tag_by_id(browser.contents, 'faq-updated'))
86
    Last updated by: Sample Person on ...