示例#1
0
    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)
示例#2
0
 def test_url_join_single_slash(self):
     pieces = ["/"]
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#3
0
 def test_url_join_single_empty_string(self):
     pieces = [""]
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#4
0
 def test_url_join_empty_list(self):
     pieces = []
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#5
0
 def test_url_join_trailing_slash(self):
     pieces = ["one", "two", "three", ""]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three/", joined)
示例#6
0
 def test_url_join_extra_slashes(self):
     pieces = ["one/", "/two//", "/three/"]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three", joined)
示例#7
0
 def test_url_join(self):
     pieces = ["one", "two", "three"]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three", joined)
示例#8
0
 def test_url_join_single_slash(self):
     pieces = ["/"]
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#9
0
 def test_url_join_single_empty_string(self):
     pieces = [""]
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#10
0
 def test_url_join_empty_list(self):
     pieces = []
     joined = common.url_join(*pieces)
     self.assertEqual("", joined)
示例#11
0
 def test_url_join_trailing_slash(self):
     pieces = ["one", "two", "three", ""]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three/", joined)
示例#12
0
 def test_url_join_extra_slashes(self):
     pieces = ["one/", "/two//", "/three/"]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three", joined)
示例#13
0
 def test_url_join(self):
     pieces = ["one", "two", "three"]
     joined = common.url_join(*pieces)
     self.assertEqual("one/two/three", joined)