Merge lp:~bac/launchpad/bug-996773-2 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 15243
Proposed branch: lp:~bac/launchpad/bug-996773-2
Merge into: lp:launchpad
Diff against target: 24 lines (+3/-0)
1 file modified
lib/lp/services/webservice/tests/test_wadl_generation.py (+3/-0)
To merge this branch: bzr merge lp:~bac/launchpad/bug-996773-2
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+105499@code.launchpad.net

Commit message

Remove generated WADL that uses https at the end of test_wadl.

Description of the change

= Summary =

WADL generation by test_wadl was generating HTTPS urls and then
caching the WADL. Subsequent API tests would then get the cached WADL
and attempt to make HTTPS connections which were then refused as only
HTTP connections are supported in our test framework.

== Proposed fix ==

Have test_wadl restore the value of the cached WADL at the end of its
run.

== Pre-implementation notes ==

Helpful discussions with Gary and Francesco.

== Tests ==

To fully test, test_wadl needs to be run first. Add the following to
a file (e.g. 'tests.txt') and then use --load-list:

lp.services.webservice.tests.test_wadl_generation.SmokeTestWadlAndDocGeneration.test_wadl
lp.bugs.tests.test_bugchanges.TestBugChanges.test_change_information_type_using_api

bin/test -vvt --load-list tests.txt

== Demo and Q/A ==

None

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/services/webservice/tests/test_wadl_generation.py

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/webservice/tests/test_wadl_generation.py'
2--- lib/lp/services/webservice/tests/test_wadl_generation.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/services/webservice/tests/test_wadl_generation.py 2012-05-14 12:39:18 +0000
4@@ -13,6 +13,7 @@
5 generate_json,
6 generate_wadl,
7 )
8+from lp.systemhomes import WebServiceApplication
9 from lp.testing import TestCase
10 from lp.testing.layers import LaunchpadFunctionalLayer
11
12@@ -23,10 +24,12 @@
13 layer = LaunchpadFunctionalLayer
14
15 def test_wadl(self):
16+ preexisting_wadl_cache = WebServiceApplication.cached_wadl
17 config = getUtility(IWebServiceConfiguration)
18 for version in config.active_versions:
19 wadl = generate_wadl(version)
20 self.assertThat(wadl[:40], StartsWith('<?xml '))
21+ WebServiceApplication.cached_wadl = preexisting_wadl_cache
22
23 def test_json(self):
24 config = getUtility(IWebServiceConfiguration)