~ubuntu-branches/ubuntu/quantal/maas/quantal

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_views_settings_clusters.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-10-08 17:02:56 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20121008170256-ucn8rg1w1ajjsvq7
Tags: 0.1+bzr1243+dfsg-0ubuntu1
* New upstream release. (LP: #1064596)
* debian/patches/99-temporary-fix-constraints.patch: Dropped.
* debian/control:
  - ${python:Depends} for maas-common.
  - Add missing Depends for python-maas-provisioningserver (LP: #1064542)
* debian/maas-cluster-controller.postinst: Create /var/log/maas if it
  doesn't exist (LP: #1064539)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    reload_object,
30
30
    )
31
31
from maasserver.testing.factory import factory
32
 
from maasserver.testing.testcase import (
33
 
    AdminLoggedInTestCase,
34
 
    )
 
32
from maasserver.testing.testcase import AdminLoggedInTestCase
35
33
from maastesting.matchers import ContainsAll
36
 
from testtools.matchers import MatchesStructure
 
34
from testtools.matchers import (
 
35
    AllMatch,
 
36
    Contains,
 
37
    Equals,
 
38
    MatchesStructure,
 
39
    )
37
40
 
38
41
 
39
42
class ClusterListingTest(AdminLoggedInTestCase):
142
145
        self.assertThat(
143
146
            reload_object(interface),
144
147
            MatchesStructure.byEquality(**data))
 
148
 
 
149
 
 
150
# XXX: rvb 2012-10-08 bug=1063881: apache transforms '//' into '/' in
 
151
# the urls it passes around and this happens when an interface has an empty
 
152
# name.
 
153
class ClusterInterfaceDoubleSlashBugTest(AdminLoggedInTestCase):
 
154
 
 
155
    def test_edit_delete_empty_cluster_interface_when_slash_removed(self):
 
156
        nodegroup = factory.make_node_group()
 
157
        interface = factory.make_node_group_interface(
 
158
            nodegroup=nodegroup, interface='',
 
159
            management=NODEGROUPINTERFACE_MANAGEMENT.UNMANAGED)
 
160
        edit_link = reverse(
 
161
            'cluster-interface-edit',
 
162
            args=[nodegroup.uuid, interface.interface])
 
163
        delete_link = reverse(
 
164
            'cluster-interface-delete',
 
165
            args=[nodegroup.uuid, interface.interface])
 
166
        links = [edit_link, delete_link]
 
167
        # Just make sure that the urls contains '//'.  If this is not
 
168
        # true anymore, because we've refactored the urls, this test can
 
169
        # problably be removed.
 
170
        self.assertThat(links, AllMatch(Contains('//')))
 
171
        # Simulate what apache (when used as a frontend) does to the
 
172
        # urls.
 
173
        new_links = [link.replace('//', '/') for link in links]
 
174
        response_statuses = [
 
175
            self.client.get(link).status_code for link in new_links]
 
176
        self.assertThat(response_statuses, AllMatch(Equals(httplib.OK)))