a ze'@sZddlZddlZddlZddlZddlZejdZddddddgd d d d gd d ddddgdddgd dddddddgdddgddd dd d!gd"d d#d$d%gd&d'dgd(d)dgd*d+dgd,d-dd.gd&d/dgd0 Z e e Z e D]Z e D]Zed1qqGd2d3d3ejZGd4d5d5ejZGd6d7d7ejZed8krVedS)9Nz mailcap.txtz moviemaker %sz""/usr/lib/Zmail/bitmaps/movie.xbm"z"Movie"zmovieplayer %s)composez x11-bitmap descriptionviewlinenoz?echo "This is \"%t\" but is 50 \% Greek to me" \; cat %s) copiousoutputrraudiocompose %s"An audio fragment" showaudio %seditrrrr mpeg_play %s rrzps-to-terminal %s) needsterminalrrzidraw %s)rrrzxdvi %s extcompose %s4"A reference to data stored in an external location"Qshowexternal %s %{access-type} %{name} %{site} %{directory} %{mode} %{server} Z composetypedrrrrz?test "`echo %{charset} | tr '[A-Z]' '[a-z]'`" = iso-8859-8z)shownonascii iso-8859-8 -e richtext -p %s )testr rrz display %s /usr/local/bin/showaudio %t animate %s z "cat %s | lp"z showframe %s)printrr) zapplication/x-moviez application/* audio/basic video/mpegzapplication/postscriptzapplication/x-dvimessage/external-bodyz text/richtextzimage/x-xwindowdumpaudio/*video/*zapplication/framez image/rgbrc@s,eZdZddZddZddZddZd S) HelperFunctionTestcCst}||t|D]}||tqtjJ}d|vrP|dt j }n ddg}t j ||d<t}Wdn1s0Y| ||dS)NMAILCAPSz/testdir1/.mailcapz/testdir2/mailcap) mailcaplistmailcapfilesassertIsInstanceliststrrsupportEnvironmentVarGuardsplitospathsepjoin assertEqual)selfZmcfilesmenvZ env_mailcapsr;E/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_mailcap.pytest_listmailcapfilesEs  &z(HelperFunctionTest.test_listmailcapfilesc CsnttdD}|tt|}Wdn1s60YWdn1sT0Y||tdS)Nr)open MAILCAPFILEZ assertWarnsDeprecationWarningr,ZreadmailcapfileassertDictEqualMAILCAPDICT_DEPRECATED)r8mcfdr;r;r<test_readmailcapfileXs  Fz'HelperFunctionTest.test_readmailcapfilecCsddddddg}ttd}|||d}ddd d d d g}ttd |}|||ddiddig}ttd}|||dS)Nr!r"rrrr&rr r r r rr%r)r,lookup MAILCAPDICTZassertListEqualrC)r8Zexpectedactualkeyr;r;r< test_lookup_s"    zHelperFunctionTest.test_lookupc Csgd}gddfgddfgddfgdd fgd d fdd d |gdfdd d |gdfg}|D]}|tj|d|dq^dS)N)zid=1znumber=2ztotal=3)rr(foo.txtr)echo foor(rLrM)zecho %sr(rLz echo foo.txt)echo %tr(rLz echo audio/*)zecho \%tr(rLrNr(rLz echo %{total}zecho 3rr)r7r,subst)r8plistZ test_casesZtcr;r;r< test_substus      zHelperFunctionTest.test_substN)__name__ __module__ __qualname__r=rFrKrQr;r;r;r<r*Csr*c@seZdZddZddZdS) GetcapsTestcCsJtj,}t|d<t}||tWdn1s<0YdS)Nr+)rr1r2r@r,getcapsrBrH)r8r:capsr;r;r<test_mock_getcapss zGetcapsTest.test_mock_getcapscCst}||tt}dd|D}|rp|D]6\}}||t||t|D]}||tqZq6n |i|dS)NcSsg|]}tj|r|qSr;)r4pathexists).0rDr;r;r< z3GetcapsTest.test_system_mailcap..) r,rVr.dictr-itemsr0r/r7)r8rWZ mailcapfilesZexistingmcfileskver;r;r<test_system_mailcaps   zGetcapsTest.test_system_mailcapN)rRrSrTrXrcr;r;r;r<rUs rUc@s6eZdZddZeejdkdddZddZ d S) FindmatchTestc Cs2t}d}gd}dddddd}dd d }d d d }d ddddd}idgidf|dgidf|dgid|ff|ddgid|ff|ddgid|ff|ddgid|ff|ddgidf|dgd|id ||ff|ddgd|id||ff|dgd|dd|ff|d gd|id!|ff|d"gd#|id$|ffg }||dS)%NrL)zaccess-type=defaultz name=johnzsite=python.orgzdirectory=/tmpzmode=fooz server=barr r r r rrr rr!r"rrrrrrr&NNzfoo/barzanimate /dev/nullr%rzaudiocompose /dev/nullrrZfoobarr)filename)rJrfr(z /usr/local/bin/showaudio audio/*r'rPz?showexternal /dev/null default john python.org /tmp foo bar)rH _run_cases) r8cZfnamerPZaudio_basic_entryZ audio_entryZ video_entryZ message_entrycasesr;r;r<test_findmatchsT     zFindmatchTest.test_findmatchposixz!Requires 'test' command on systemcCsLddigddigd}|ddgidddiff|ddgidfg}||dS)Nrz test 1 -eq 1z test 1 -eq 0) test/pass test/failrlrmre)rg)r8rWrir;r;r< test_testszFindmatchTest.test_testcCs2|D](}|tj|di|d|dqdS)Nrrr)r7r,Z findmatch)r8rirhr;r;r<rgszFindmatchTest._run_casesN) rRrSrTrjunittestZ skipUnlessr4namernrgr;r;r;r<rds3 rd__main__)r,r4copyZ test.supportrror1Zfindfiler@rHdeepcopyrCvaluesZ entry_listentrypopZTestCaser*rUrdrRmainr;r;r;r<sh          1  BL