%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/launchpadlib/testing/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/launchpadlib/testing/__pycache__/helpers.cpython-312.pyc

�

�{a��4�dZeZgd�ZddlmZddlZddlmZddl	m
Z
mZmZe
�Zd�ZGd�d	e�ZGd
�de�ZGd�d
e�Zed��ZGd�d�ZGd�d�ZGd�d�ZGd�d�Zedd�Zedd�Zedd�Zy)zlaunchpadlib testing helpers.)
�BadSaveKeyring�fake_keyring�FauxSocketModule�InMemoryKeyring�NoNetworkAuthorizationEngine�NoNetworkLaunchpad�TestableLaunchpad�nopriv_read_nonprivate�salgado_read_nonprivate�salgado_with_full_permissions�)�contextmanagerN)�	Launchpad)�AccessToken�Credentials�RequestTokenAuthorizationEnginec�\�ttjdt�tusJd��y)N�keyringz>During tests the real keyring module should never be imported.)�getattr�launchpadlib�credentials�missing���>/usr/lib/python3/dist-packages/launchpadlib/testing/helpers.py�assert_keyring_not_importedr2s+����(�(�)�W�=��H�H�G�H�Hrc�2��eZdZdZdZ�fd�Zd�Zd�Z�xZS)raAn authorization engine that doesn't open a web browser.

    You can use this to test the creation of Launchpad objects and the
    storing of credentials. You can't use it to interact with the web
    service, since it only pretends to authorize its OAuth request tokens.
    z
access_key:84c�H��tt|�
|i|��d|_d|_y)Nr)�superr�__init__�request_tokens_obtained�access_tokens_obtained)�self�args�kwargs�	__class__s   �rrz%NoNetworkAuthorizationEngine.__init__Bs(���
�*�D�:�D�K�F�K�'(��$�&'��#rc�.�|xjdz
c_y)zsPretend to get a request token from the server.

        We do this by simply returning a static token ID.
        �zrequest_token:42)r )r"rs  r�get_request_tokenz.NoNetworkAuthorizationEngine.get_request_tokenHs��
	
�$�$��)�$�!rc�d�t|jd�|_|xjdz
c_y)z�Pretend to exchange a request token for an access token.

        We do this by simply setting the access_token property.
        zaccess_secret:168r'N)r�ACCESS_TOKEN_KEY�access_tokenr!)r"r�
request_tokens   r�make_end_user_authorize_tokenz:NoNetworkAuthorizationEngine.make_end_user_authorize_tokenPs0��
$/��!�!�#6�$
�� �	
�#�#�q�(�#r)	�__name__�
__module__�__qualname__�__doc__r*rr(r-�
__classcell__�r%s@rrr8s����'��(�"�)rrc�&�eZdZdZd�Zed��Zy)rz�A Launchpad instance for tests with no network access.

    It's only useful for making sure that certain methods were called.
    It can't be used to interact with the API.
    c	�X�||_||_||_t|||||��|_y)N��service_root�cache�timeout�
proxy_info�version)r�authorization_engine�credential_store�dict�passed_in_args)	r"rr<r=r7r8r9r:r;s	         rrzNoNetworkLaunchpad.__init__bs8��'���$8��!� 0���"�%���!��
��rc��t|�S�N)r)�clsr#s  r�authorization_engine_factoryz/NoNetworkLaunchpad.authorization_engine_factoryxs
��+�T�2�2rN)r.r/r0r1r�classmethodrCrrrrr[s ���
�,�3��3rrc�F��eZdZdZddddddej
f�fd�	Z�xZS)rz5A base class for talking to the testing root service.N�test_devc	
�<��tt|�||||||||��y)a\Provide test-friendly defaults.

        :param authorization_engine: Defaults to None, since a test
            environment can't use an authorization engine.
        :param credential_store: Defaults to None, since tests
            generally pass in fully-formed Credentials objects.
        :param service_root: Defaults to 'test_dev'.
        r6N)rrr)
r"rr<r=r7r8r9r:r;r%s
         �rrzTestableLaunchpad.__init__�s2���&	���/�� ��%���!��	0�		
r)r.r/r0r1r�DEFAULT_VERSIONrr2r3s@rrr}s-���?�
"�������)�)�
�
rrc#�K�t�|tj_ttj_	d��tj`tj`y#tj`tj`wxYw�w)zAA context manager which injects a testing keyring implementation.N)rrrr�RuntimeError�NoKeyringError)�fakes rrr�se���� �!�'+�L���$�.:�L���+�4�
��$�$�,��$�$�3��
�$�$�,��$�$�3�s�9B�A!�!B�!"B�Bc��eZdZdZd�Zy)rz:A socket module replacement that provides a fake hostname.c��y)N�HOSTNAMEr�r"s r�gethostnamezFauxSocketModule.gethostname�s��rN)r.r/r0r1rQrrrrr�s
��D�rrc��eZdZdZd�Zd�Zy)rz6A keyring that generates errors when saving passwords.c��yrAr�r"�service�usernames   r�get_passwordzBadSaveKeyring.get_password�s��rc��t�rA)rJ�r"rUrV�passwords    r�set_passwordzBadSaveKeyring.set_password�s���rN)r.r/r0r1rWr[rrrrr�s��@��rrc�"�eZdZdZd�Zd�Zd�Zy)rz.A keyring that saves passwords only in memory.c��i|_yrA��datarPs rrzInMemoryKeyring.__init__�s	����	rc�&�||j||f<yrAr^rYs    rr[zInMemoryKeyring.set_password�s��'/��	�	�'�8�#�$rc�<�|jj||f�SrA)r_�getrTs   rrWzInMemoryKeyring.get_password�s���y�y�}�}�g�x�0�1�1rN)r.r/r0r1rr[rWrrrrr�s��8��0�2rrc�:�eZdZdZd�Zdddejfd�Zy)�KnownTokensz'Known access token/secret combinations.c�z�||_||_t||�|_t	d|j��|_y)Nzlaunchpad-library)�
consumer_namer+)�token_string�
access_secretr�tokenrr)r"rgrhs   rrzKnownTokens.__init__�s6��(���*��� ��}�=��
�&�-�D�J�J�
��rNc�6�t|j||||��S)z2Create a Launchpad object using these credentials.)r8r9r:r;)rr)r"r8r9r:r;s     r�loginzKnownTokens.login�s&��!������!��
�	
r)r.r/r0r1rrrHrkrrrrdrd�s#��1�
�����)�)�
rrdzsalgado-change-anything�testzsalgado-read-nonprivate�secretznopriv-read-nonprivate�mystery)r1�type�
__metaclass__�__all__�
contextlibr
r�launchpadlib.launchpadr�launchpadlib.credentialsrrr�objectrrrrrrrrrrdrr
r	rrr�<module>rvs���&$��
���&��,����(��H� )�#B� )�F3��3�D
�	�
�D�
4��
4�����
2�
2�
�
�8!,�,E�v� N��%�&?��J��$�%=�y�I�r

Zerion Mini Shell 1.0