def test_parse_filter_adds_penalize(): # arrange # assert filters = parse_filters(None, None, [('penalize', 'mimetype', 'contains', 'text')]) # act assert not filters.get('favor', None) assert filters['penalize'][0] == Filter('mimetype', FilterComparison.CONTAINS, 'text')
def test_parse_filter_returns_empty_lists_on_empty_list(): # arrange # assert filters = parse_filters(None, None, []) # act assert isinstance(filters.get('accept', []), list) and len( filters.get('accept', [])) == 0 assert isinstance(filters.get('reject', []), list) and len( filters.get('reject', [])) == 0
def test_parse_filter_adds_accept(): # arrange # assert filters = parse_filters(None, None, [('accept', 'mimetype', 'contains', 'text')]) # act assert filters['accept'][0] == Filter('mimetype', FilterComparison.CONTAINS, 'text') assert not filters.get('reject', None)