def is_filter_translators(self): is_filter_translators = { 'assigned': (SearchKey('unassigned'), SearchValue(False)), 'unassigned': (SearchKey('unassigned'), SearchValue(True)), } for status_key, status_value in STATUS_CHOICES.items(): is_filter_translators[status_key] = (SearchKey('status'), SearchValue(status_value)) return is_filter_translators
def is_filter_translators(self): is_filter_translators = { 'assigned': (SearchKey('unassigned'), SearchValue(False)), 'unassigned': (SearchKey('unassigned'), SearchValue(True)), } for status_key, status_value in STATUS_CHOICES.items(): is_filter_translators[status_key] = (SearchKey('status'), SearchValue(status_value)) return is_filter_translators
def is_filter_translators(self): is_filter_translators = { "assigned": (SearchKey("unassigned"), SearchValue(False)), "unassigned": (SearchKey("unassigned"), SearchValue(True)), } for status_key, status_value in STATUS_CHOICES.items(): is_filter_translators[status_key] = (SearchKey("status"), SearchValue(status_value)) return is_filter_translators
def test_valid(self): for status_string, status_val in STATUS_CHOICES.items(): filters = [SearchFilter(SearchKey("status"), "=", SearchValue(status_string))] result = convert_query_values(filters, [self.project], self.user, None) assert result[0].value.raw_value == status_val filters = [SearchFilter(SearchKey("status"), "=", SearchValue(status_val))] result = convert_query_values(filters, [self.project], self.user, None) assert result[0].value.raw_value == status_val
def test_is_query_status(self): for status_string, status_val in STATUS_CHOICES.items(): assert parse_search_query("is:%s" % status_string) == [ SearchFilter(key=SearchKey(name="status"), operator="=", value=SearchValue(status_val)) ] assert parse_search_query("!is:%s" % status_string) == [ SearchFilter(key=SearchKey(name="status"), operator="!=", value=SearchValue(status_val)) ]
def test_is_query_status(self): for status_string, status_val in STATUS_CHOICES.items(): assert parse_search_query('is:%s' % status_string) == [ SearchFilter( key=SearchKey(name='status'), operator='=', value=SearchValue(status_val), ), ] assert parse_search_query('!is:%s' % status_string) == [ SearchFilter( key=SearchKey(name='status'), operator='!=', value=SearchValue(status_val), ), ]