def test_parse_courierdb(): tmp = its.parse_courierdb('testdata/Maildir/courierimapkeywords/:list', {'spam': ['junk', 'alsojunk'], 'ham': ['nonjunk']}) print os.path.realpath('testdata/Maildir/courierimapkeywords/:list') WVPASSEQ(len(tmp['spam']), 4) WVPASSEQ(len(tmp['ham']), 1) WVPASS('1_mail_spam' in tmp['spam']) WVPASS('1_mail_spam_x' in tmp['spam']) WVPASS('1_mail_spam2' in tmp['spam']) WVPASS('1_mail_spam3' in tmp['spam']) WVPASS('1_mail_ham' in tmp['ham'])
def test_get_path_from_filename(): tmp = its.get_path_from_filename(os.path.realpath('testdata/'), its.parse_courierdb('testdata/Maildir/courierimapkeywords/:list', {'spam': ['junk', 'alsojunk'], 'ham': ['nonjunk']})) WVPASSEQ(len(tmp['spam']), 4) WVPASSEQ(len(tmp['ham']), 1) WVPASS(os.path.realpath('testdata/Maildir/mails/1_mail_spam:header') in tmp['spam']) WVPASS(os.path.realpath('testdata/Maildir/mails/1_mail_spam_x:xy') in tmp['spam']) WVPASS(os.path.realpath('testdata/Maildir/mails/1_mail_spam2:xyz') in tmp['spam']) WVPASS(os.path.realpath('testdata/Maildir/mails/1_mail_spam3:xyz') in tmp['spam']) WVPASS(os.path.realpath('testdata/Maildir/mails/1_mail_ham:random') in tmp['ham'])