def ls(name, is_id_, resolver, filter_spec=None, allowed_api_query_params=None): endpoint = resolver.get_endpoint() if name: get_id_and_print_json(get_named_or_id(name, is_id_, resolver)) else: (api_query_params, cli_params) = filtering.parse_filters(filter_spec, allowed_api_query_params) all_entities = rest_crud.get_with_pagination(endpoint, api_query_params=api_query_params) print_json(filtering.remove_by_filter(all_entities, cli_params))
def call_get_with_pagination(self, monkeypatch, page_size, nb_total_of_elements, is_implemented_in_api): if monkeypatch is not None: monkeypatch.setattr( rest_crud, 'get', lambda actual_endpoint, actual_params: self.mock_get_return( actual_endpoint, actual_params, nb_total_of_elements, is_implemented_in_api)) return rest_crud.get_with_pagination('/v2/test-results', page_size)
def __fill_map(self, ws, name=None): all_element = rest_crud.get_with_pagination(self.get_endpoint()) json = None ws_map = {} self.__map[ws] = ws_map for element in all_element: name_ = element['name'] ws_map[name_] = element['id'] if name_ == name: json = element return json
def ls(name, is_id_, resolver): endpoint = resolver.get_endpoint() if name: get_id_and_print_json(get_named_or_id(name, is_id_, resolver)) else: print_json(rest_crud.get_with_pagination(endpoint))