Current Path : /usr/lib/python2.7/dist-packages/keyring/tests/ |
Current File : //usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyc |
F+Oc @ s d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d Z d Z d Z d e j j f d YZ d e f d YZ d e j f d YZ d e j f d YZ d Z e d k re j d d n d S( s3 test_core.py Created by Kang Zhang on 2009-08-09 iNs This is passwords This is password2s keyringrc.cfgt TestKeyringc B s) e Z d Z d Z d Z d Z RS( s A faked keyring for test. c C s d S( Ni ( ( t self( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt supported s c C s t S( N( t PASSWORD_TEXT( R t servicet username( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt get_password s c C s d S( Ni ( ( R R R t password( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt set_password s ( t __name__t __module__t __doc__R R R ( ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR s t TestKeyring2c B s e Z d Z d Z RS( s$ Another faked keyring for test. c C s t S( N( t PASSWORD_TEXT_2( R R R ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR $ s ( R R R R ( ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR ! s t CoreTestCasec B s, e Z d Z d Z d Z d Z RS( c C s9 t j j d d d | j t j j d d d d S( s0 Test the basic function of the keyring. t testt usert passtestN( t keyringt coreR t assertEqualR ( R ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt test_set_get_password( s c C sL t j j t t j j d d d | j t j j d d t d S( s5 Test the function of set keyring in runtime. R R R N( R R t set_keyringR R R R R ( R ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt test_set_keyring_in_runtime. s c C s t t d } | j d d t j j t j j t d g | j t j j t j j d d d | j t j j d d t t j t d S( s1 Test setting the keyring by config file. t ws [backend] s keyring-path= %s s' default-keyring=test_core.TestKeyring2 R R R N( t opent KEYRINGRCt writelinest ost patht dirnamet abspatht __file__t closeR R t init_backendR R R R t remove( R t config_file( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt test_set_keyring_in_config7 s c C sS t j } t j } t j | t j j t j j d d } t j j | ru t j | | d t } n t } t j j t j j | d } t | d } | j d | j t j j t j j | d } t | d } | j d | j t j j t j | t j | | rOt j | d | n d S( Nt ~s keyringrc.cfgs .oldR s [keyring]s [backend]( t tempfilet mkdtempR t getcwdt chdirR t joint expandusert existst renamet Truet FalseR R t load_configR t writeR! t shutilt rmtree( R t tempdirt old_locationt personal_cfgt personal_renamedt cfgt f( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyt test_load_configM s. ! ( R R R R R% R; ( ( ( s; /usr/lib/python2.7/dist-packages/keyring/tests/test_core.pyR ' s t LocationTestCasec B s e Z e j j d Z e j j e j j j d Z e j e j j e d e j e j j e d e d Z RS( s ~/keyringrc.cfgs keyringrc.cfgs7 Location test requires non-existence of ~/keyringrc.cfgs8 Location test requires non-existence of %(new_location)sc C sK t | j d } | j d Wd QXt j d d g } t j | d t j d t j } | j \ } } | j d k s t | zk t j j | j s t t j j | j s t t | j } d | j k s t Wd QXWd t j j | j rt j | j n t j j | j rFt j | j n Xd S( s When starting the keyring module and ~/keyringrc.cfg exists, it should be moved and the user should be informed that it was moved. R s [test config] Ns -csP import sys; sys.path.remove(""); import keyring.core; keyring.core.load_config()t stderrt stdouti s test config( R t legacy_locationR2 t syst executablet subprocesst Popent PIPEt communicatet returncodet AssertionErrorR R R- t new_locationt readR# ( R R: t cmdt procR>