~lifeless/python-oops-tools/amqp

« back to all changes in this revision

Viewing changes to src/oopstools/oops/test/pagetest.txt

  • Committer: Robert Collins
  • Date: 2011-10-13 20:18:51 UTC
  • Revision ID: robertc@robertcollins.net-20111013201851-ym8jmdhoeol3p83s
Export of cruft-deleted tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
The main oops page allows searching for an oops report using the unique
 
2
OOPS id.
 
3
 
 
4
    >>> from oopstools.oops import djangobrowser
 
5
 
 
6
    >>> b = djangobrowser.Browser()
 
7
    >>> b.open('http://localhost/oops/')
 
8
 
 
9
    >>> b.title
 
10
    'Search Launchpad OOPS Reports'
 
11
 
 
12
Using a invalid OOPS id the page returns a nice error message saying no OOPS
 
13
match the given id.
 
14
 
 
15
    >>> b.getControl(name="oopsid").value = "foo"
 
16
    >>> b.getControl("Search OOPS").click()
 
17
 
 
18
    >>> b.url
 
19
    'http://localhost/oops/?oopsid=foo'
 
20
 
 
21
    >>> print b.contents
 
22
    <...
 
23
    ...Your search: <b>foo</b> didn't match any oops...
 
24
    ...
 
25
 
 
26
Using a valid OOPS id the OOPS page is correctly rendered.
 
27
 
 
28
    >>> b.getControl(name="oopsid").value = "OOPS-689S4"
 
29
    >>> b.getControl("Search OOPS").click()
 
30
 
 
31
    >>> b.url
 
32
    'http://localhost/oops/?oopsid=OOPS-689S4'
 
33
 
 
34
    >>> print b.contents
 
35
    <...
 
36
    ...<title>OOPS-689S4</title>...
 
37
    ...
 
38
    ...<div id="request_variables">...
 
39
    ...
 
40
    ...<li>CHANNEL_CREATION_TIME: 1...</li>...
 
41
    ...
 
42
 
 
43
It also accepts the OOPS id without the "OOPS-" part.
 
44
 
 
45
    >>> b.open('http://localhost/oops/')
 
46
    >>> b.getControl(name="oopsid").value = "689S4"
 
47
    >>> b.getControl("Search OOPS").click()
 
48
 
 
49
    >>> b.url
 
50
    'http://localhost/oops/?oopsid=689S4'
 
51
 
 
52
    >>> print b.contents
 
53
    <...
 
54
    ...<title>OOPS-689S4</title>...
 
55
    ...
 
56
 
 
57
It doesn't care about case.
 
58
 
 
59
    >>> b.open('http://localhost/oops/')
 
60
    >>> b.getControl(name="oopsid").value = "oops-689S4"
 
61
    >>> b.getControl("Search OOPS").click()
 
62
 
 
63
    >>> b.url
 
64
    'http://localhost/oops/?oopsid=oops-689S4'
 
65
 
 
66
    >>> print b.contents
 
67
    <...
 
68
    ...<title>OOPS-689S4</title>...
 
69
    ...
 
70
 
 
71
It will also allow lower-case IDs with no OOPS- prefix, as used in ISD.
 
72
 
 
73
    >>> b.open('http://localhost/oops/')
 
74
    >>> b.getControl(name="oopsid").value = "1925canistelubuntu0"
 
75
    >>> b.getControl("Search OOPS").click()
 
76
 
 
77
    >>> b.url
 
78
    'http://localhost/oops/?oopsid=1925canistelubuntu0'
 
79
 
 
80
    >>> print b.contents
 
81
    <...
 
82
    ...<title>1925canistelubuntu0</title>...
 
83
    ...
 
84
 
 
85
If an OOPS is not in the database, the view uses as a fallback the OopsStore
 
86
to look for the oops report in the filesystem. First let's remove it from
 
87
the database.
 
88
 
 
89
    >>> from oopstools.oops.models import Oops
 
90
    >>> oops = Oops.objects.get(oopsid='OOPS-689S4')
 
91
    >>> oops.delete()
 
92
 
 
93
    >>> Oops.objects.get(oopsid='OOPS-689S4')
 
94
    Traceback (most recent call last):
 
95
    ...
 
96
    DoesNotExist: Oops matching query does not exist.
 
97
 
 
98
And try to search for the OOPS report again.
 
99
 
 
100
    >>> b.open('http://localhost/oops/')
 
101
    >>> b.getControl(name="oopsid").value = "OOPS-689S4"
 
102
    >>> b.getControl("Search OOPS").click()
 
103
 
 
104
    >>> b.url
 
105
    'http://localhost/oops/?oopsid=OOPS-689S4'
 
106
 
 
107
    >>> print b.contents
 
108
    <...
 
109
    ...<title>OOPS-689S4</title>...
 
110
    ...
 
111
 
 
112
Now the OOPS has been added to the database.
 
113
 
 
114
    >>> Oops.objects.get(oopsid='OOPS-689S4')
 
115
    <Oops: OOPS-689S4>