%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/launchpadlib/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/launchpadlib/tests/__pycache__/test_credential_store.cpython-312.pyc

�

Ʋ�a�"����dZddlZddlZddlZddlmZeeureZ	neZ	ddl
mZmZddl
mZmZmZmZGd�dej$�ZGd�d	ej$�ZGd
�de�ZGd�d
e�Zy)z'Tests for the credential store classes.�N)�	b64decode)�fake_keyring�InMemoryKeyring)�AccessToken�Credentials�KeyringCredentialStore�UnencryptedFileCredentialStorec��eZdZdZd�Zd�Zy)�TestAccessTokenz Tests for the AccessToken class.c���tjd�}|jd|j�|jd|j�|j|j�y)Nz;oauth_token_secret=secret%3Dpassword&oauth_token=lock%26key�lock&key�secret=password)r�from_string�assertEqual�key�secret�assertIsNone�context��self�access_tokens  �J/usr/lib/python3/dist-packages/launchpadlib/tests/test_credential_store.py�test_from_stringz TestAccessToken.test_from_string/sX��"�.�.�I�
��	
����\�%5�%5�6����*�L�,?�,?�@����,�.�.�/�c���tjd�}|jd|j�|jd|j�|jd|j
�y)NzNoauth_token_secret=secret%3Dpassword&oauth_token=lock%26key&lp.context=firefoxr
r�firefox)rrrrrrrs  r�test_from_string_with_contextz-TestAccessToken.test_from_string_with_context7s\��"�.�.�
!�
��	
����\�%5�%5�6����*�L�,?�,?�@�����L�$8�$8�9rN)�__name__�
__module__�__qualname__�__doc__rr�rrrr,s��*�0�:rrc��eZdZd�Zy)�CredentialStoreTestCasec�2�tddt|d���S)z(Helper method to make a fake credential.zapp namezconsumer_secret:42zaccess_secret:168)�consumer_secretr)rr)r�consumer_keys  r�make_credentialz'CredentialStoreTestCase.make_credentialBs ����0�$�\�3F�G�
�	
rN)rrr r(r"rrr$r$As��
rr$c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�"TestUnencryptedFileCredentialStorez3Tests for the UnencryptedFileCredentialStore class.c�p�tj�\}|_t|j�|_y�N)�tempfile�mkstemp�filenamer	�store)r�ignores  r�setUpz(TestUnencryptedFileCredentialStore.setUpNs'�� (� 0� 0� 2����
�3�D�M�M�B��
rc��tjj|j�r tj|j�yyr,)�os�path�existsr/�remove�rs r�tearDownz+TestUnencryptedFileCredentialStore.tearDownRs+��
�7�7�>�>�$�-�-�(��I�I�d�m�m�$�)rc��|jd�}|jj|d�|jjd�}|j	|j
j|j
j�y�N�consumer key�
unique key�r(r0�save�loadr�consumerr�r�
credential�credential2s   r�test_save_and_loadz5TestUnencryptedFileCredentialStore.test_save_and_loadVs^���)�)�.�9�
��
�
���
�L�1��j�j�o�o�l�3������,�,�0�0�+�2F�2F�2J�2J�Krc��|jd�}|jj|d�|jjd�}|j	|j
j|j
j�y)Nr<zsome keyzsome other keyr>rBs   r�test_unique_id_doesnt_matterz?TestUnencryptedFileCredentialStore.test_unique_id_doesnt_matter]sa���)�)�.�9�
��
�
���
�J�/��j�j�o�o�&6�7������,�,�0�0�+�2F�2F�2J�2J�Krc�b�|jd�}|jd�}|jj|d�|jj|d�|jjd�}|j	|j
j|j
j�y)Nr<�
consumer key2zunique key 1zunique key 2r>�r�credential1rD�loadeds    r�&test_file_only_contains_one_credentialzITestUnencryptedFileCredentialStore.test_file_only_contains_one_credentiales���
�*�*�>�:���*�*�?�;���
�
����^�4��
�
����^�4�������0��������,�,�k�.B�.B�.F�.F�GrN)	rrr r!r2r9rErGrMr"rrr*r*Ks"��=�C�%�L�L�
Hrr*c�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�TestKeyringCredentialStorez+Tests for the KeyringCredentialStore class.c�@�t�|_t�|_yr,)r�keyringrr0r8s rr2z TestKeyringCredentialStore.setUpus��&�(���+�-��
rc�\�t|j�5|jd�}|jj	|d�|jjd�}|j
|jj|jj�ddd�y#1swYyxYwr;�	rrQr(r0r?r@rrArrBs   rrEz-TestKeyringCredentialStore.test_save_and_loadys���
�$�,�,�
'�	P��-�-�n�=�J��J�J�O�O�J��5��*�*�/�/�,�7�K����Z�0�0�4�4�k�6J�6J�6N�6N�O�		P�	P�	P�s�BB"�"B+c��t|j�5|jd�}|jj	|d�|jd�}|jj	|d�|jjd�}|j
|�|j|jj|jj�|jjd�}|j|jj|jj�ddd�y#1swYyxYw)N�
consumer key1zkey 1rIzkey 2)
rrQr(r0r?r@�
assertTruerrAr)rrKrD�loaded1�loaded2s     r�test_lookup_by_unique_keyz4TestKeyringCredentialStore.test_lookup_by_unique_key�s����$�,�,�
'�	M��.�.��?�K��J�J�O�O�K��1��.�.��?�K��J�J�O�O�K��1��j�j�o�o�g�.�G��O�O�G�$����[�1�1�5�5�w�7G�7G�7K�7K�L��j�j�o�o�g�.�G����[�1�1�5�5�w�7G�7G�7K�7K�L�	M�	M�	M�s�DD5�5D>c��t|j�5|jd�}|jj	|d�|jd�}|jj	|d�|jjd�}|j
|jj|jj�ddd�y#1swYyxYw)NrUzthe only keyrIrSrJs    r�/test_reused_unique_id_overwrites_old_credentialzJTestKeyringCredentialStore.test_reused_unique_id_overwrites_old_credential�s����$�,�,�
'�	L��.�.��?�K��J�J�O�O�K��8��.�.��?�K��J�J�O�O�K��8��Z�Z�_�_�^�4�F����[�1�1�5�5�v���7J�7J�K�	L�	L�	L�s�B0C�Cc��t|j�5|j|jj	d��ddd�y#1swYyxYw)Nzno such key)rrQrr0r@r8s r�test_bad_unique_id_returns_nonez:TestKeyringCredentialStore.test_bad_unique_id_returns_none�s@���$�,�,�
'�	>����d�j�j�o�o�m�<�=�	>�	>�	>�s�+A
�
Ac�P��G�fd�dt����|_t|j�5|jd�}|j	|�|j
j
|d�|j
jd�}|j	|�|j|jj|jj�|j|jj|jj�ddd�y#1swYyxYw)Nc�"���eZdZ��fd�Z�xZS)�WTestKeyringCredentialStore.test_keyring_returns_unicode.<locals>.UnicodeInMemoryKeyringc�j��t�|�||�}t|t�r|j	d�}|S)Nzutf-8)�super�get_password�
isinstance�unicode_type�encode)r�service�username�password�UnicodeInMemoryKeyring�	__class__s    ��rrczdTestKeyringCredentialStore.test_keyring_returns_unicode.<locals>.UnicodeInMemoryKeyring.get_password�s9��� �!7��K��X����h��5�'���w�7�H��r�rrr rc�
__classcell__)rkrjs@�rrjr`�s
���
 �
 rrjr<r=)rrQrr(rVr0r?r@rrArr)rrCrDrjs   @r�test_keyring_returns_unicodez7TestKeyringCredentialStore.test_keyring_returns_unicode�s����	 �_�	 �.�/���
�$�,�,�
'�
	��-�-�n�=�J��O�O�J�'��J�J�O�O�J��5��*�*�/�/�,�7�K��O�O�K�(����Z�0�0�4�4�k�6J�6J�6N�6N�O�����#�#�*�*�K�,@�,@�,G�,G�
�
	�
	�
	�s�CD�D%c���G�fd�dt����|_t|j�5|jd�}|jj|d�|jj
d�}|j|jj|jj�|j|jj|jj�ddd�y#1swYyxYw)Nc�"���eZdZ��fd�Z�xZS)�XTestKeyringCredentialStore.test_nonencoded_key_handled.<locals>.UnencodedInMemoryKeyringc�@��t�|�||�}t|dd�S)N�)rbrcr)rrgrh�pw�UnencodedInMemoryKeyringrks    ��rrczeTestKeyringCredentialStore.test_nonencoded_key_handled.<locals>.UnencodedInMemoryKeyring.get_password�s-����3�T�G��X���!��A�B��(�(rrl)rkrus@�rrurq�s
���
)�
)rrur<r=)rrQrr(r0r?r@rrArr)rrCrDrus   @r�test_nonencoded_key_handledz6TestKeyringCredentialStore.test_nonencoded_key_handled�s����	)��	)�0�1���
�$�,�,�
'�	��-�-�n�=�J��J�J�O�O�J��5��*�*�/�/�,�7�K����Z�0�0�4�4�k�6J�6J�6N�6N�O�����#�#�*�*�K�,@�,@�,G�,G�
�	�	�	�s�B=C:�:Dc�@�Gd�dt�}|�|_t|j�5|jd�}|jj|d�|jj
d�}|j|�ddd�y#1swYyxYw)Nc��eZdZd�Zy)�WTestKeyringCredentialStore.test_corrupted_key_handled.<locals>.CorruptedInMemoryKeyringc��y)N�badr")rrgrhs   rrczdTestKeyringCredentialStore.test_corrupted_key_handled.<locals>.CorruptedInMemoryKeyring.get_password�s��rN)rrr rcr"rr�CorruptedInMemoryKeyringry�s��
rr|r<r=)rrQrr(r0r?r@r)rr|rCrDs    r�test_corrupted_key_handledz5TestKeyringCredentialStore.test_corrupted_key_handled�s}��	��	�0�1���
�$�,�,�
'�	+��-�-�n�=�J��J�J�O�O�J��5��*�*�/�/�,�7�K����k�*�		+�	+�	+�s�AB�BN)rrr r!r2rErYr[r]rnrvr}r"rrrOrOrs0��5�.�P�M�"L�>��4�(+rrO)r!r4r-�unittest�base64r�bytes�str�unicodere�launchpadlib.testing.helpersrr�launchpadlib.credentialsrrrr	�TestCaserr$r*rOr"rr�<module>r�sy��".�	�����C�<��L��L��
��:�h�'�'�:�*
�h�/�/�
�$H�)@�$H�Nn+�!8�n+r

Zerion Mini Shell 1.0