Your IP : 172.28.240.42


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


Nc@sdZddlZddlZddlZddlmZddlmZmZddl	m
Z
mZmZm
Z
dejfdYZdefd	YZd
efdYZdS(s'Tests for the credential store classes.iN(t	b64decode(tfake_keyringtInMemoryKeyring(tAccessTokentCredentialstKeyringCredentialStoretUnencryptedFileCredentialStoretCredentialStoreTestCasecBseZdZRS(cCstddddt|dS(s(Helper method to make a fake credential.sapp nametconsumer_secretsconsumer_secret:42taccess_tokensaccess_secret:168(RR(tselftconsumer_key((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pytmake_credential(s(t__name__t
__module__R(((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR&st"TestUnencryptedFileCredentialStorecBs;eZdZdZdZdZdZdZRS(s3Tests for the UnencryptedFileCredentialStore class.cCs+tj\}|_t|j|_dS(N(ttempfiletmkstemptfilenameRtstore(R
tignore((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pytsetUp2scCs,tjj|jr(tj|jndS(N(tostpathtexistsRtremove(R
((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttearDown6scCsT|jd}|jj|d|jjd}|j|jj|jjdS(Nsconsumer keys
unique key(RRtsavetloadtassertEqualstconsumertkey(R
t
credentialtcredential2((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_save_and_load:scCsT|jd}|jj|d|jjd}|j|jj|jjdS(Nsconsumer keyssome keyssome other key(RRRRRRR(R
R R!((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_unique_id_doesnt_matterAscCsv|jd}|jd}|jj|d|jj|d|jjd}|j|jj|jjdS(Nsconsumer keys
consumer key2sunique key 1sunique key 2(RRRRRRR(R
tcredential1R!tloaded((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyt&test_file_only_contains_one_credentialIs(R
Rt__doc__RRR"R#R&(((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR/s				tTestKeyringCredentialStorecBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	s+Tests for the KeyringCredentialStore class.cCst|_t|_dS(N(RtkeyringRR(R
((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyRYscCsjt|jU|jd}|jj|d|jjd}|j|jj|jjWdQXdS(Nsconsumer keys
unique key(	RR)RRRRRRR(R
R R!((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR"]scCst|j|jd}|jj|d|jd}|jj|d|jjd}|j|jj|jj|jjd}|j|jj|jjWdQXdS(Ns
consumer key1skey 1s
consumer key2skey 2(	RR)RRRRRRR(R
R$R!tloaded1tloaded2((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_lookup_by_unique_keyfscCst|jw|jd}|jj|d|jd}|jj|d|jjd}|j|jj|jjWdQXdS(Ns
consumer key1sthe only keys
consumer key2(	RR)RRRRRRR(R
R$R!R%((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyt/test_reused_unique_id_overwrites_old_credentialxscCs6t|j!|jd|jjdWdQXdS(Nsno such key(RR)RtNoneRR(R
((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_bad_unique_id_returns_nonescsdtffdY|_t|jq|jd}|jj|d|jjd}|j|jj	|jj	|j|jj
|jj
WdQXdS(NtUnicodeInMemoryKeyringcseZfdZRS(cstt|j||S(N(tunicodetsupertget_password(R
tservicetusername(R0(sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR3s(R
RR3((R0(sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR0ssconsumer keys
unique key(RR)RRRRRRRRtsecret(R
R R!((R0sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_keyring_returns_unicodescsdtffdY|_t|jq|jd}|jj|d|jjd}|j|jj	|jj	|j|jj
|jj
WdQXdS(NtUnencodedInMemoryKeyringcseZfdZRS(cs)t|j||}t|dS(Ni(R2R3R(R
R4R5tpw(R8(sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR3s(R
RR3((R8(sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR8ssconsumer keys
unique key(RR)RRRRRRRRR6(R
R R!((R8sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_nonencoded_key_handledscCs}dtfdY}||_t|jF|jd}|jj|d|jjd}|j|WdQXdS(NtCorruptedInMemoryKeyringcBseZdZRS(cSsdS(Ntbad((R
R4R5((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR3s(R
RR3(((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR;ssconsumer keys
unique key(RR)RRRRRtassertIsNone(R
R;R R!((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyttest_corrupted_key_handleds(R
RR'RR"R,R-R/R7R:R>(((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyR(Vs								(R'RRtunittesttbase64Rtlaunchpadlib.testing.helpersRRtlaunchpadlib.credentialsRRRRtTestCaseRRR((((sL/usr/lib/python2.7/dist-packages/launchpadlib/tests/test_credential_store.pyt<module>s"	'