def scope(self, value): """Take a URL and split it into origin, path :raises ValueError: if URL is invalid (origin cannot be parsed) """ parsed_origin, parsed_path = parse_scope_from_url(value) if parsed_origin is None: raise ValueError("Invalid URL for scope: missing origin component") self._origin = parsed_origin self._path = parsed_path
def test_it_parses_origin_and_path_from_url(self, url, expected_scope): assert scope_util.parse_scope_from_url(url) == expected_scope