def generate_href(self, version, path=None): """Create an url that refers to a specific version_number.""" # TODO(Dinesh_Bhor) When there will be increment in version then we can # define the default version_number according to the 'version' given # but currently the 'version_number' should be 'v1' by default. version_number = 'v1' path = path or '' return common.url_join(self.prefix, version_number, path)
def test_url_join_single_slash(self): pieces = ["/"] joined = common.url_join(*pieces) self.assertEqual("", joined)
def test_url_join_single_empty_string(self): pieces = [""] joined = common.url_join(*pieces) self.assertEqual("", joined)
def test_url_join_empty_list(self): pieces = [] joined = common.url_join(*pieces) self.assertEqual("", joined)
def test_url_join_trailing_slash(self): pieces = ["one", "two", "three", ""] joined = common.url_join(*pieces) self.assertEqual("one/two/three/", joined)
def test_url_join_extra_slashes(self): pieces = ["one/", "/two//", "/three/"] joined = common.url_join(*pieces) self.assertEqual("one/two/three", joined)
def test_url_join(self): pieces = ["one", "two", "three"] joined = common.url_join(*pieces) self.assertEqual("one/two/three", joined)