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