Exemplo n.º 1
0
 def endpoint_url(self, endpoint):
     endpoint = StrUtils.decapitate(endpoint, self.api_ver_url)
     endpoint = StrUtils.decapitate(endpoint, self.api_ver_url_no_port)
     endpoint = StrUtils.decapitate(endpoint, '/')
     components = [self.url, self.api]
     if self.api_version != 'wp/v1':
         components += [self.api_version]
     components += [endpoint]
     return UrlUtils.join_components(components)
Exemplo n.º 2
0
    def test_str_remove_head(self):
        self.assertEqual(
            'sdf',
            StrUtils.remove_head('/sdf', '/')
        )

        self.assertEqual(
            'sdf',
            StrUtils.decapitate('sdf', '/')
        )
Exemplo n.º 3
0
 def endpoint_url(self, endpoint):
     endpoint = StrUtils.decapitate(endpoint, '/')
     return UrlUtils.join_components(
         [self.url, self.api, self.api_version, endpoint])