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)
def test_str_remove_head(self): self.assertEqual( 'sdf', StrUtils.remove_head('/sdf', '/') ) self.assertEqual( 'sdf', StrUtils.decapitate('sdf', '/') )
def endpoint_url(self, endpoint): endpoint = StrUtils.decapitate(endpoint, '/') return UrlUtils.join_components( [self.url, self.api, self.api_version, endpoint])