예제 #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)