def test_add2url_with_querystring(self): """add a query string """ url = "/path/" add = "?foo=bar" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/?foo=bar") url = "/path/#top" add = "?foo=bar" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/?foo=bar#top") url = "/path/" add = "?foo=bar#top" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/?foo=bar#top") url = "/path/?foo=bar" add = "#top" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/?foo=bar#top") url = "/path/#bottom" add = "?foo=bar#top" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/?foo=bar#top")
def test_add2url_basic(self): """Merge 'http://www.com/path/?cgi=abc#top' with 'subdirectory/' """ url = "http://www.com/path/?cgi=abc#top" add = "subdirectory/" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "http://www.com/path/subdirectory/?cgi=abc#top") url = "/path/?cgi=abc#top" add = "subdirectory/" rendered = newsletter_extras.add2url(url, add) self.assertEqual(rendered, "/path/subdirectory/?cgi=abc#top")