Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/keyring/tests/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyc


F+Oc@sdZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZdZdZdZ
dejjfdYZdefd	YZd
ejfdYZdejfd
YZdZedkrejddndS(s3
test_core.py

Created by Kang Zhang on 2009-08-09
iNsThis is passwordsThis is password2s
keyringrc.cfgtTestKeyringcBs)eZdZdZdZdZRS(sA faked keyring for test.
    cCsdS(Ni((tself((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt	supportedscCstS(N(t
PASSWORD_TEXT(Rtservicetusername((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pytget_passwordscCsdS(Ni((RRRtpassword((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pytset_passwords(t__name__t
__module__t__doc__RRR(((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyRs		tTestKeyring2cBseZdZdZRS(s$Another faked keyring for test.
    cCstS(N(tPASSWORD_TEXT_2(RRR((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR$s(R	R
RR(((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR!stCoreTestCasecBs,eZdZdZdZdZRS(cCs9tjjddd|jtjjddddS(s0Test the basic function of the keyring.
        ttesttusertpasstestN(tkeyringtcoreRtassertEqualR(R((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyttest_set_get_password(scCsLtjjttjjddd|jtjjddtdS(s5Test the function of set keyring in runtime.
        RRRN(RRtset_keyringRRRRR(R((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyttest_set_keyring_in_runtime.scCsttd}|jddtjjtjjtdg|jt	j
jt	j
jddd|j
t	j
jddttjtdS(	s1Test setting the keyring by config file.
        tws
[backend]
skeyring-path= %s
s'default-keyring=test_core.TestKeyring2
RRRN(topent	KEYRINGRCt
writelinestostpathtdirnametabspatht__file__tcloseRRtinit_backendRRRR
tremove(Rtconfig_file((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyttest_set_keyring_in_config7s	


cCsStj}tj}tj|tjjtjjdd}tjj|rutj	||dt
}nt}tj
jtjj|d}t|d}|jd|jtj
jtjj|d}t|d}|jd|jtj
jtj|tj||rOtj	|d|ndS(Nt~s
keyringrc.cfgs.oldRs	[keyring]s	[backend](ttempfiletmkdtempRtgetcwdtchdirRtjoint
expandusertexiststrenametTruetFalseRRtload_configRtwriteR!tshutiltrmtree(Rttempdirtold_locationtpersonal_cfgtpersonal_renamedtcfgtf((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyttest_load_configMs.
!	








(R	R
RRR%R;(((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR's				tLocationTestCasecBseZejjdZejjejj	j
dZej
ejjedej
ejjededZRS(s~/keyringrc.cfgs
keyringrc.cfgs7Location test requires non-existence of ~/keyringrc.cfgs8Location test requires non-existence of %(new_location)scCsKt|jd}|jdWdQXtjddg}tj|dtjdtj}|j\}}|j	dkst
|zktjj
|jst
tjj
|jst
t|j}d	|jkst
WdQXWdtjj
|jrtj|jntjj
|jrFtj|jnXdS(
s
        When starting the keyring module and ~/keyringrc.cfg exists, it
        should be moved and the user should be informed that it was
        moved.
        Rs[test config]
Ns-csPimport sys; sys.path.remove(""); import keyring.core; keyring.core.load_config()tstderrtstdoutistest config(Rtlegacy_locationR2tsyst
executablet
subprocesstPopentPIPEtcommunicatet
returncodetAssertionErrorRRR-tnew_locationtreadR#(RR:tcmdtprocR>R=((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyttest_moves_compatss!"(R	R
RRR,R?R+Rtutiltplatformt	data_rootRHtunittesttskipIfR-tvarsRL(((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR<ns	cCs<tj}|jtjt|jtjt|S(N(RPt	TestSuitetaddTestt	makeSuiteRR<(tsuite((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt
test_suitest__main__tdefaultTestRW(RRPRR@R'R3RBtkeyring.backendRtkeyring.coretkeyring.util.platformRR
RtbackendtKeyringBackendRRtTestCaseRR<RWR	tmain(((s;/usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt<module>s&G'