def test_alert_query_str_with_page_size_gives_correct_json_representation( event_filter_group): alert_query = AlertQuery(_TENANT_ID, event_filter_group) alert_query.page_size = 500 json_query_str = JSON_QUERY_BASE.format(_TENANT_ID, "AND", event_filter_group, 0, 500, "desc", "CreatedAt") assert str(alert_query) == json_query_str
def _construct_query(state, begin, end, advanced_query, or_query): if advanced_query: state.search_filters = advanced_query else: if begin or end: state.search_filters.append( create_time_range_filter(f.DateObserved, begin, end)) if or_query: state.search_filters = convert_to_or_query(state.search_filters) query = AlertQuery(*state.search_filters) query.page_size = ALERT_PAGE_SIZE query.sort_direction = "asc" query.sort_key = "CreatedAt" return query