~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/tests/test_publisher.py

  • Committer: Guilherme Salgado
  • Date: 2010-07-23 08:50:49 UTC
  • mfrom: (11206 launchpad)
  • mto: This revision was merged to the branch mainline in revision 11220.
  • Revision ID: salgado@canonical.com-20100723085049-4m2tmvujxsw2ns40
mergeĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Tests for bugs' custom publications."""
 
5
 
 
6
__metaclass__ = type
 
7
 
 
8
from canonical.config import config
 
9
from canonical.launchpad.layers import WebServiceLayer
 
10
from canonical.testing.layers import FunctionalLayer
 
11
 
 
12
from lp.testing import TestCase
 
13
from lp.testing.publication import get_request_and_publication
 
14
 
 
15
from lp.bugs.publisher import BugsLayer
 
16
 
 
17
 
 
18
class TestRegistration(TestCase):
 
19
    """Bugs publication customizations are installed correctly."""
 
20
 
 
21
    layer = FunctionalLayer
 
22
 
 
23
    def test_bugs_request_provides_bugs_layer(self):
 
24
        # The request constructed for requests to the bugs hostname provides
 
25
        # BugsLayer.
 
26
        request, publication = get_request_and_publication(
 
27
            host=config.vhost.bugs.hostname)
 
28
        self.assertProvides(request, BugsLayer)
 
29
 
 
30
    def test_bugs_host_has_api(self):
 
31
        # Requests to /api on the bugs domain are treated as web service
 
32
        # requests.
 
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))