5Xc@sdZddlmZddlmZddlZddlZddlmZm Z m Z ddl m Z m Z mZmZmZddljjZddlmZeeZdejfd YZd ejfd YZd Zd efdYZdS(s>tests for passlib.hash -- (c) Assurance Technologies 2003-2009i(twith_statement(t getLoggerN(thashtregistrytexc(tregister_crypt_handlertregister_crypt_handler_pathtget_crypt_handlertlist_crypt_handlerst_unload_handler_name(tTestCasetdummy_0cBseZdZRS(R (t__name__t __module__tname(((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyR st alt_dummy_0cBseZdZRS(R (R R R(((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyRsit RegistryTestcBsMeZdZdZdZdZdZdZdZdZ RS(spasslib.registrycsTtt|jttjttjfd}|j|dS(Ncs>tjjtjjtjjtjjdS(N(Rt _locationstcleartupdatet _handlers((thandlerst locations(s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pytrestore0s  (tsuperRtsetUptdictRRRt addCleanup(tselfR((RRs?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyR*s cCstttt|jtttdttdd}t}|t_|j tj||dkrt`|j t tdn|t_|j tj|dt j fdY}|t_|j td||jtttd|dS(stest passlib.hash proxy objecttfooeyt __loader__tdummy_1cBseZdZRS(R(R R R(((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyRPstdummy_1xN(tdirRtreprt assertRaisestAttributeErrortgetattrtNonetobjectRtassertIst assertFalsethasattrtuht StaticHandlerRRt ValueErrortsetattr(RtoldttestR((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyttest_hash_proxy7s        cCstj}|jd|k|jttd|jttdd|jttdt d|jttdt dtdt |jdt k|jdt dt k|j tj t |jdt dt ktdtdt d|j tj ttdtdt |jttdtdt |jttdtdtjjd d td d tj$tjd d ttd }Wd QXddlm}|j ||jd S(s"test register_crypt_handler_path()R s.test_registrys :dummy_0:xxxs :dummy_0.xxxt loaded_onlys :alt_dummy_0tdummy_xRs passlib.tests._test_bad_registert dummy_badtignoret xxxxxxxxxxNi(t_test_bad_register(RRt assertTrueR)R*RR#R-RR RtTrueR(R tunload_handler_nameRt TypeErrorRtsystmodulestpopR&twarningstcatch_warningstfilterwarningstDeprecationWarningt passlib.testsR7t alt_dummy_bad(Rtpathsthttbr((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyt test_register_crypt_handler_pathXs<             c Cs|jtti|jtttdtjftdd |jtttdtjftdd|jtttdtjftdd|jtttdtjftdd|jtttdtjftdddtjfdY}d tjfd Y}|j dt kt|t||j t d||jt t||j t d|t|d t|j t d||j dt kd S( stest register_crypt_handler()txRtAB_CDsab-cdtab__cdtdefaultRcBseZdZRS(R(R R R(((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyRstdummy_1bcBseZdZRS(R(R R R(((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyRMstforceN(R#R;RR-ttypeR+R,RR&R8RR(RtKeyErrorR9(RRRM((s?/usr/lib/python2.7/site-packages/passlib/tests/test_registry.pyttest_register_crypt_handlers".....  cCs'dtjfdY}|jttd|jtdddt||jtd|tj Qtj ddt |jtd|t dt |jtdtWdQXd dl}d |jjd s  (