def test_nipsa_filter_coerces_userid_to_lowercase(group_service, user): user.userid = 'DonkeyNose' filter_ = search.nipsa_filter(group_service, user) assert {'term': {'user': '******'}} in ( filter_["bool"]["should"])
def test_nipsa_filter_group_annotations_not_filtered_for_creator(group_service, user): group_service.groupids_created_by.return_value = ['pubid-1', 'pubid-4', 'pubid-3'] filter_ = search.nipsa_filter(group_service, user) assert {'terms': {'group': ['pubid-1', 'pubid-4', 'pubid-3']}} in ( filter_['bool']['should'])
def test_nipsa_filter_filters_out_nipsad_annotations(): """nipsa_filter() filters out annotations with "nipsa": True.""" assert search.nipsa_filter() == { "bool": { "should": [ {'not': {'term': {'nipsa': True}}} ] } }
def test_nipsa_filter_filters_out_nipsad_annotations(group_service): """nipsa_filter() filters out annotations with "nipsa": True.""" assert search.nipsa_filter(group_service) == { "bool": { "should": [ {'not': {'term': {'nipsa': True}}}, {'exists': {'field': 'thread_ids'}}, ] } }
def test_nipsa_filter_filters_out_nipsad_annotations(): """nipsa_filter() filters out annotations with "nipsa": True.""" assert search.nipsa_filter() == { "bool": { "should": [{ 'not': { 'term': { 'nipsa': True } } }] } }
def test_nipsa_filter_users_own_annotations_are_not_filtered(): filter_ = search.nipsa_filter(userid="fred") assert {'term': {'user': '******'}} in (filter_["bool"]["should"])
def test_nipsa_filter_coerces_userid_to_lowercase(): filter_ = search.nipsa_filter(userid="DonkeyNose") assert {'term': {'user': '******'}} in (filter_["bool"]["should"])
def test_nipsa_filter_users_own_annotations_are_not_filtered(): filter_ = search.nipsa_filter(userid="fred") assert {'term': {'user': '******'}} in ( filter_["bool"]["should"])
def test_nipsa_filter_users_own_annotations_are_not_filtered(group_service, user): filter_ = search.nipsa_filter(group_service, user) assert {'term': {'user': '******'}} in ( filter_["bool"]["should"])
def test_nipsa_filter_coerces_userid_to_lowercase(): filter_ = search.nipsa_filter(userid="DonkeyNose") assert {'term': {'user': '******'}} in ( filter_["bool"]["should"])