Esempio n. 1
0
def test_filter_profiles_empty_filter_no_prefix():
    new_profiles = [{'cat_time': u'2015-02-19T03:03:53Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6887990, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test3'}, {'cat_time': u'2015-02-19T03:03:42Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6888014, 'profile_title': u'User:Jmorgan (WMF)/test profile2'}, {'cat_time': u'2015-02-18T23:39:25Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6895623, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan1'}, {'cat_time': u'2015-02-18T20:35:22Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6888016, 'profile_title': u'User:Jmorgan (WMF)/test profile3'}, {'cat_time': u'2015-02-25T20:53:10Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6950116, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan (WMF)'}, {'cat_time': u'2015-02-19T02:39:21Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6887990, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test3'}, {'cat_time': u'2015-02-18T23:39:25Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6895623, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan1'}, {'cat_time': u'2015-02-17T23:48:26Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6888016, 'profile_title': u'User:Jmorgan (WMF)/test profile3'}, {'cat_time': u'2015-02-17T23:46:57Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6888014, 'profile_title': u'User:Jmorgan (WMF)/test profile2'}, {'cat_time': u'2015-02-18T18:28:12Z', 'category': u'Category:IdeaLab members interested in global south projects', 'profile_id': 6893810, 'profile_title': u'User:Jmorgan (WMF)/Test'}, {'cat_time': u'2015-02-17T23:46:17Z', 'category': u'Category:IdeaLab members interested in global south projects', 'profile_id': 6888013, 'profile_title': u'User:Jmorgan (WMF)/test profile1'}]
    opted_out_profiles = []
    prefix = u''
    filtered_profiles = filter_profiles(new_profiles, opted_out_profiles, prefix)
    desired_result = {u'User:Jmorgan (WMF)/Jmorgan1': {'cat_time': u'2015-02-18T23:39:25Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6895623, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan1'}, u'User:Jmorgan (WMF)/sandbox/Test3': {'cat_time': u'2015-02-19T02:39:21Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6887990, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test3'}, u'User:Jmorgan (WMF)/Test': {'cat_time': u'2015-02-18T18:28:12Z', 'category': u'Category:IdeaLab members interested in global south projects', 'profile_id': 6893810, 'profile_title': u'User:Jmorgan (WMF)/Test'}, u'User:Jmorgan (WMF)/Jmorgan (WMF)': {'cat_time': u'2015-02-25T20:53:10Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6950116, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan (WMF)'}, u'User:Jmorgan (WMF)/test profile2': {'cat_time': u'2015-02-17T23:46:57Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6888014, 'profile_title': u'User:Jmorgan (WMF)/test profile2'}, u'User:Jmorgan (WMF)/test profile3': {'cat_time': u'2015-02-17T23:48:26Z', 'category': u'Category:IdeaLab members interested in gender gap projects', 'profile_id': 6888016, 'profile_title': u'User:Jmorgan (WMF)/test profile3'}, u'User:Jmorgan (WMF)/test profile1': {'cat_time': u'2015-02-17T23:46:17Z', 'category': u'Category:IdeaLab members interested in global south projects', 'profile_id': 6888013, 'profile_title': u'User:Jmorgan (WMF)/test profile1'}}
    assert filtered_profiles == desired_result
Esempio n. 2
0
def test_filter_profiles_bad_filter():
    opted_out_profiles = [{'profileid': 6849665}, {'profileid': 6849665}]
    filter_profiles([], opted_out_profiles, '')
Esempio n. 3
0
def test_filter_bad_profiles():
    bad_profiles = [{'cat_time': u'2015-02-19T03:03:53Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6887990}, {'cat_time': u'2015-02-19T03:03:42Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6888014}, {'cat_time': u'2015-02-18T23:39:25Z', 'category': u'Category:IdeaLab members with project management experience', 'profile_id': 6895623, 'profile_title': u'User:Jmorgan (WMF)/Jmorgan1'}]
    opted_out_profiles = [{'profileid': 6849665, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test2'}, {'profileid': 6849665, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test3'}]
    filter_profiles(bad_profiles, opted_out_profiles, u'')
Esempio n. 4
0
def test_filter_no_profiles():
    opted_out_profiles = [{'profileid': 6849665, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test2'}, {'profileid': 6849665, 'profile_title': u'User:Jmorgan (WMF)/sandbox/Test3'}]
    filtered_profiles = filter_profiles([], opted_out_profiles, u'User:Jmorgan (WMF)/')
    assert filtered_profiles == {}