~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/testing/layers.py

[r=mwhudson,
        salgado][ui=none] Make it possible to use launchpadlib from pagetests,
        without automatically creating a Launchpad object for every test layer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
from storm.zope.interfaces import IZStorm
74
74
import transaction
75
75
import wsgi_intercept
 
76
from wsgi_intercept import httplib2_intercept
76
77
 
77
78
from lazr.restful.utils import safe_hasattr
78
79
 
939
940
        register_launchpad_request_publication_factories()
940
941
        wsgi_intercept.add_wsgi_intercept(
941
942
            'localhost', 80, lambda: wsgi_application)
 
943
        wsgi_intercept.add_wsgi_intercept(
 
944
            'api.launchpad.dev', 80, lambda: wsgi_application)
 
945
        httplib2_intercept.install()
 
946
 
942
947
 
943
948
    @classmethod
944
949
    @profiled
945
950
    def tearDown(cls):
946
951
        FunctionalLayer.isSetUp = False
947
952
        wsgi_intercept.remove_wsgi_intercept('localhost', 80)
 
953
        wsgi_intercept.remove_wsgi_intercept('api.launchpad.dev', 80)
 
954
        httplib2_intercept.uninstall()
948
955
        # Signal Layer cannot be torn down fully
949
956
        raise NotImplementedError
950
957