31
31
from maasserver.testing.factory import factory
32
from maasserver.testing.testcase import (
33
AdminLoggedInTestCase,
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 (
39
42
class ClusterListingTest(AdminLoggedInTestCase):
143
146
reload_object(interface),
144
147
MatchesStructure.byEquality(**data))
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
153
class ClusterInterfaceDoubleSlashBugTest(AdminLoggedInTestCase):
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)
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
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)))