1
# Copyright 2010 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Tests for bugs' custom publications."""
8
from canonical.config import config
9
from canonical.launchpad.layers import WebServiceLayer
10
from canonical.testing.layers import FunctionalLayer
12
from lp.testing import TestCase
13
from lp.testing.publication import get_request_and_publication
15
from lp.bugs.publisher import BugsLayer
18
class TestRegistration(TestCase):
19
"""Bugs publication customizations are installed correctly."""
21
layer = FunctionalLayer
23
def test_bugs_request_provides_bugs_layer(self):
24
# The request constructed for requests to the bugs hostname provides
26
request, publication = get_request_and_publication(
27
host=config.vhost.bugs.hostname)
28
self.assertProvides(request, BugsLayer)
30
def test_bugs_host_has_api(self):
31
# Requests to /api on the bugs domain are treated as web service
33
request, publication = get_request_and_publication(
34
host=config.vhost.bugs.hostname,
35
extra_environment={'PATH_INFO': '/api/1.0'})
36
# XXX MichaelHudson, 2010-07-20, bug=607664: WebServiceLayer only
37
# actually provides WebServiceLayer in the sense of verifyObject after
38
# traversal has started.
39
self.assertTrue(WebServiceLayer.providedBy(request))