def setUp(self):
     fltrs = [
         filters.String('string_field', 'string_param'),
         filters.Int('int_field', 'int_param')
     ]
     self.filter = filters.Keyword(fltrs, 'field', 'param')
     self.query = mock.Mock()
KEYWORD_FILTERS = [
    GroupFilter(),
    filters.String('bug_indices', 'issue'),
    filters.String('platform', 'platform'),
    filters.String('impact_stable_version_indices', 'stable'),
    filters.String('impact_beta_version_indices', 'beta'),
    filters.String('fuzzer_name_indices', 'fuzzer'),
    filters.String('job_type', 'job'),
]

FILTERS = [
    filters.String('impact_version_indices', 'impact'),
    filters.Boolean('has_bug_flag', 'issue'),
    filters.Boolean('open', 'open'),
    filters.Boolean('security_flag', 'security'),
    filters.Keyword(KEYWORD_FILTERS, 'keywords', 'q'),
    filters.NegativeBoolean('one_time_crasher_flag', 'reproducible'),
    filters.String('job_type', 'job'),
    filters.String('fuzzer_name_indices', 'fuzzer'),
    filters.String('project_name', 'project'),
    filters.Int('crash_revision', 'revision_greater_than', operator='>')
]


def add_filters(query, params):
    """Add filters based on params."""
    if not filters.has_params(params, FILTERS) and not params.get('showall'):
        params['open'] = 'yes'

    query.filter('status', 'Processed')
    query.filter('is_a_duplicate_flag', False)
Exemple #3
0
from datastore import data_types
from datastore import ndb_utils
from fuzzing import fuzzer_selection
from handlers import base_handler
from libs import filters
from libs import form
from libs import gcs
from libs import handler
from libs import helpers
from libs.query import datastore_query

PAGE_SIZE = 10
MORE_LIMIT = 50 - PAGE_SIZE  # exactly 5 pages

FILTERS = [
    filters.Keyword([], 'keywords', 'q'),
]


def get_queues():
    """Return list of task queues."""
    queues = []
    for name, display_name in six.iteritems(tasks.TASK_QUEUE_DISPLAY_NAMES):
        queue = {
            'name': name,
            'display_name': display_name,
        }
        queues.append(queue)

    queues.sort(key=lambda q: q['display_name'])
    return queues