10714.2.1
by Brad Crittenden
Changed test runner to discover registry/doc/launchpadlib. |
1 |
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
|
8687.15.22
by Karl Fogel
Add the copyright header block to the remaining .py files. |
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
3 |
||
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
4 |
"""
|
5 |
Run the doctests and pagetests.
|
|
6 |
"""
|
|
7 |
||
8 |
import logging |
|
9 |
import os |
|
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
10 |
|
8267.1.1
by Barry Warsaw
Fixes for bug 364628, OOPSes in mailing list XMLRPC interface. These were |
11 |
import transaction |
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
12 |
|
14604.1.1
by Curtis Hovey
Separate test-authoring classes from test-running classes. |
13 |
from lp.testing.layers import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
14 |
DatabaseFunctionalLayer, |
15 |
DatabaseLayer, |
|
16 |
LaunchpadFunctionalLayer, |
|
17 |
LaunchpadZopelessLayer, |
|
18 |
)
|
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
19 |
from lp.registry.tests import mailinglists_helper |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
20 |
from lp.services.testing import ( |
21 |
build_doctest_suite, |
|
22 |
build_test_suite, |
|
23 |
)
|
|
14578.4.4
by William Grant
format-imports. |
24 |
from lp.testing.systemdocs import ( |
25 |
LayeredDocFileSuite, |
|
26 |
setUp, |
|
27 |
tearDown, |
|
28 |
)
|
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
29 |
|
30 |
||
31 |
here = os.path.dirname(os.path.realpath(__file__)) |
|
32 |
||
33 |
||
34 |
def peopleKarmaTearDown(test): |
|
35 |
"""Restore the database after testing karma."""
|
|
36 |
# We can't detect db changes made by the subprocess (yet).
|
|
37 |
DatabaseLayer.force_dirty_database() |
|
38 |
tearDown(test) |
|
39 |
||
10714.2.1
by Brad Crittenden
Changed test runner to discover registry/doc/launchpadlib. |
40 |
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
41 |
def mailingListXMLRPCInternalSetUp(test): |
42 |
setUp(test) |
|
11572.1.6
by Curtis Hovey
Remove redundant code. |
43 |
mailinglist_api = mailinglists_helper.MailingListXMLRPCTestProxy( |
44 |
context=None, request=None) |
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
45 |
test.globs['mailinglist_api'] = mailinglist_api |
8267.1.1
by Barry Warsaw
Fixes for bug 364628, OOPSes in mailing list XMLRPC interface. These were |
46 |
test.globs['commit'] = transaction.commit |
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
47 |
|
48 |
||
49 |
def mailingListXMLRPCExternalSetUp(test): |
|
50 |
setUp(test) |
|
51 |
# Use a real XMLRPC server proxy so that the same test is run through the
|
|
52 |
# full security machinery. This is more representative of the real-world,
|
|
53 |
# but more difficult to debug.
|
|
12398.2.12
by Jonathan Lange
Move canonical.functional to lp.testing.xmlrpc, since it only had XMLRPC testing stuff. |
54 |
from lp.testing.xmlrpc import XMLRPCTestTransport |
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
55 |
from xmlrpclib import ServerProxy |
56 |
mailinglist_api = ServerProxy( |
|
57 |
'http://xmlrpc-private.launchpad.dev:8087/mailinglists/', |
|
58 |
transport=XMLRPCTestTransport()) |
|
59 |
test.globs['mailinglist_api'] = mailinglist_api |
|
60 |
# See above; right now this is the same for both the internal and external
|
|
61 |
# tests, but if we're able to resolve the big XXX above the
|
|
62 |
# mailinglist-xmlrpc.txt-external declaration below, I suspect that these
|
|
63 |
# two globals will end up being different functions.
|
|
64 |
test.globs['mailinglist_api'] = mailinglist_api |
|
8267.1.1
by Barry Warsaw
Fixes for bug 364628, OOPSes in mailing list XMLRPC interface. These were |
65 |
test.globs['commit'] = transaction.commit |
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
66 |
|
67 |
||
68 |
special = { |
|
8322.4.1
by Curtis Hovey
Moved the distributionmirror objects to lp.registry. |
69 |
'distribution-mirror.txt': LayeredDocFileSuite( |
70 |
'../doc/distribution-mirror.txt', |
|
71 |
setUp=setUp, tearDown=tearDown, |
|
72 |
layer=LaunchpadFunctionalLayer, |
|
73 |
),
|
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
74 |
'person-karma.txt': LayeredDocFileSuite( |
75 |
'../doc/person-karma.txt', |
|
76 |
setUp=setUp, tearDown=peopleKarmaTearDown, |
|
77 |
layer=LaunchpadFunctionalLayer, |
|
78 |
stdout_logging_level=logging.WARNING |
|
79 |
),
|
|
80 |
'mailinglist-xmlrpc.txt': LayeredDocFileSuite( |
|
81 |
'../doc/mailinglist-xmlrpc.txt', |
|
82 |
setUp=mailingListXMLRPCInternalSetUp, |
|
83 |
tearDown=tearDown, |
|
84 |
layer=LaunchpadFunctionalLayer |
|
85 |
),
|
|
86 |
'mailinglist-xmlrpc.txt-external': LayeredDocFileSuite( |
|
87 |
'../doc/mailinglist-xmlrpc.txt', |
|
88 |
setUp=mailingListXMLRPCExternalSetUp, |
|
89 |
tearDown=tearDown, |
|
90 |
layer=LaunchpadFunctionalLayer, |
|
91 |
),
|
|
92 |
'mailinglist-subscriptions-xmlrpc.txt': LayeredDocFileSuite( |
|
93 |
'../doc/mailinglist-subscriptions-xmlrpc.txt', |
|
94 |
setUp=mailingListXMLRPCInternalSetUp, |
|
95 |
tearDown=tearDown, |
|
96 |
layer=LaunchpadFunctionalLayer |
|
97 |
),
|
|
98 |
'mailinglist-subscriptions-xmlrpc.txt-external': LayeredDocFileSuite( |
|
99 |
'../doc/mailinglist-subscriptions-xmlrpc.txt', |
|
100 |
setUp=mailingListXMLRPCExternalSetUp, |
|
101 |
tearDown=tearDown, |
|
102 |
layer=LaunchpadFunctionalLayer, |
|
103 |
),
|
|
8203.4.1
by Curtis Hovey
Updated lp.registry.doc to test on the DatabaseFunctionalLayer. Extracted the |
104 |
'message-holds.txt': LayeredDocFileSuite( |
105 |
'../doc/message-holds.txt', |
|
106 |
setUp=setUp, |
|
107 |
tearDown=tearDown, |
|
108 |
layer=LaunchpadFunctionalLayer, |
|
109 |
),
|
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
110 |
'message-holds-xmlrpc.txt': LayeredDocFileSuite( |
111 |
'../doc/message-holds-xmlrpc.txt', |
|
112 |
setUp=mailingListXMLRPCInternalSetUp, |
|
113 |
tearDown=tearDown, |
|
114 |
layer=LaunchpadFunctionalLayer |
|
115 |
),
|
|
116 |
'message-holds-xmlrpc.txt-external': LayeredDocFileSuite( |
|
117 |
'../doc/message-holds-xmlrpc.txt', |
|
118 |
setUp=mailingListXMLRPCExternalSetUp, |
|
119 |
tearDown=tearDown, |
|
120 |
layer=LaunchpadFunctionalLayer, |
|
121 |
),
|
|
9606.1.4
by Brad Crittenden
Fixed test to exercise product ownership change. |
122 |
'product.txt': LayeredDocFileSuite( |
123 |
'../doc/product.txt', |
|
124 |
setUp=setUp, |
|
125 |
tearDown=tearDown, |
|
126 |
layer=LaunchpadFunctionalLayer, |
|
127 |
),
|
|
9606.1.5
by Brad Crittenden
Allow ProductRelease and TranslationImportQueueEntry to be owned/imported by a private team. |
128 |
'private-team-roles.txt': LayeredDocFileSuite( |
129 |
'../doc/private-team-roles.txt', |
|
130 |
setUp=setUp, |
|
131 |
tearDown=tearDown, |
|
132 |
layer=LaunchpadFunctionalLayer, |
|
133 |
),
|
|
8203.4.1
by Curtis Hovey
Updated lp.registry.doc to test on the DatabaseFunctionalLayer. Extracted the |
134 |
'productrelease.txt': LayeredDocFileSuite( |
135 |
'../doc/productrelease.txt', |
|
136 |
setUp=setUp, |
|
137 |
tearDown=tearDown, |
|
138 |
layer=LaunchpadFunctionalLayer, |
|
139 |
),
|
|
140 |
'productrelease-file-download.txt': LayeredDocFileSuite( |
|
141 |
'../doc/productrelease-file-download.txt', |
|
142 |
setUp=setUp, |
|
143 |
tearDown=tearDown, |
|
144 |
layer=LaunchpadFunctionalLayer, |
|
145 |
),
|
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
146 |
'standing.txt': LayeredDocFileSuite( |
147 |
'../doc/standing.txt', |
|
148 |
layer=LaunchpadZopelessLayer, |
|
149 |
setUp=setUp, tearDown=tearDown, |
|
150 |
),
|
|
151 |
'karmacache.txt': LayeredDocFileSuite( |
|
8137.17.8
by Barry Warsaw
Rewrite MailingListAPIView.getMembershipInformation() to use the new, more |
152 |
'../doc/karmacache.txt', |
153 |
layer=LaunchpadZopelessLayer, |
|
154 |
setUp=setUp, tearDown=tearDown), |
|
8303.14.9
by Julian Edwards
Fix a few more tests. |
155 |
'sourcepackage.txt': LayeredDocFileSuite( |
156 |
'../doc/sourcepackage.txt', |
|
157 |
layer=LaunchpadFunctionalLayer, |
|
158 |
setUp=setUp, tearDown=tearDown), |
|
8771.3.3
by Michael Nelson
Updated to take optional karma argument to restrict results. |
159 |
'distribution-sourcepackage.txt': LayeredDocFileSuite( |
160 |
'../doc/distribution-sourcepackage.txt', |
|
161 |
layer=LaunchpadZopelessLayer, |
|
162 |
setUp=setUp, tearDown=tearDown), |
|
7675.110.3
by Curtis Hovey
Ran the migration script to move registry code to lp.registry. |
163 |
}
|
164 |
||
165 |
||
166 |
def test_suite(): |
|
10714.2.1
by Brad Crittenden
Changed test runner to discover registry/doc/launchpadlib. |
167 |
suite = build_test_suite(here, special, layer=DatabaseFunctionalLayer) |
11568.2.2
by Curtis Hovey
Hushed lint. |
168 |
launchpadlib_path = os.path.join(os.path.pardir, 'doc', 'launchpadlib') |
10714.2.1
by Brad Crittenden
Changed test runner to discover registry/doc/launchpadlib. |
169 |
lplib_suite = build_doctest_suite(here, launchpadlib_path, |
170 |
layer=DatabaseFunctionalLayer) |
|
171 |
suite.addTest(lplib_suite) |
|
172 |
return suite |