Пример #1
0
 def test_absolute_url_reverse_copes_with_trailing_slash(self):
     maas_url = factory.make_simple_http_url()
     path = urlparse(maas_url).path + '/'
     self.useFixture(RegionConfigurationFixture(maas_url=maas_url))
     absolute_url = absolute_url_reverse('settings')
     expected_url = path[:-1] + reverse('settings')
     self.assertEqual(expected_url, absolute_url)
Пример #2
0
 def test_absolute_url_reverse_uses_path_from_maas_url(self):
     maas_url = factory.make_simple_http_url()
     self.useFixture(RegionConfigurationFixture(maas_url=maas_url))
     path = urlparse(maas_url).path
     absolute_url = absolute_url_reverse('settings')
     expected_url = path + reverse('settings')
     self.assertEqual(expected_url, absolute_url)
Пример #3
0
 def test_absolute_url_reverse_uses_query_string(self):
     maas_url = factory.make_simple_http_url()
     path = urlparse(maas_url).path
     self.useFixture(RegionConfigurationFixture(maas_url=maas_url))
     parameters = {factory.make_string(): factory.make_string()}
     absolute_url = absolute_url_reverse('settings', query=parameters)
     expected_url = path + "%s?%s" % (reverse('settings'),
                                      urlencode(parameters))
     self.assertEqual(expected_url, absolute_url)