%PDF- %PDF-
Direktori : /lib/python3/dist-packages/launchpadlib/tests/__pycache__/ |
Current File : //lib/python3/dist-packages/launchpadlib/tests/__pycache__/test_launchpad.cpython-312.pyc |
� ���cI� � � � d Z eZddlmZ ddlZddlZddlZddlZddl Z ddl Z ddlmZ ddlZddlmZ ddlmZmZ ddlmZ ddlZddlmZ dd lmZ dd lmZmZmZmZmZm Z m!Z! ddlm"Z" dZ# G d � de jH � Z% G d� de jH � Z& G d� de jH � Z' G d� de jH � Z( G d� de jH � Z) G d� de jH � Z* G d� de jH � Z+ G d� de+� Z, G d� de+� Z- G d� d e jH � Z. G d!� d"e jH � Z/y# e $ r ddlmZ Y ��$w xY w)#zTests for the Launchpad class.� )�contextmanagerN)�patch)�ServiceRoot)�AccessToken�Credentials)�uris)� Launchpad)�UnencryptedFileCredentialStore)�assert_keyring_not_imported�BadSaveKeyring�fake_keyring�FauxSocketModule�InMemoryKeyring�NoNetworkAuthorizationEngine�NoNetworkLaunchpad)�KeyringCredentialStore�http://api.example.com/c � � e Zd ZdZd� Zy)�TestResourceTypeClassesz<launchpadlib must know about restfulclient's resource types.c � � t j j � D ]( \ }}| j t j | |� �* y �N)r �RESOURCE_TYPE_CLASSES�items�assertEqualr )�self�name�clss �C/usr/lib/python3/dist-packages/launchpadlib/tests/test_launchpad.py�test_resource_typesz+TestResourceTypeClasses.test_resource_typesB sC � � %�:�:�@�@�B� I�I�D�#����Y�<�<�T�B�C�H� I� N)�__name__� __module__�__qualname__�__doc__r � r r r r ? s � �F�Ir r c �\ � e Zd ZdZd� Zed� � Zd� Zd� Zd� Z d� Z d� Zd � Zd � Z d� Zd� Zy )�TestNameLookupsz0Test the utility functions in the 'uris' module.c �( � t g d�� | _ y )N)� production� qastaging�staging�dogfood�dev�test_dev�edge)�sorted�aliases�r s r �setUpzTestNameLookups.setUpL s � �� � ��r c # �Z K � t j d�� 5 }t j d� d �� | j t |� d� |\ }| j t |j t � � | j dt |� � d d d � y # 1 sw Y y xY w�w)NT��record�always� zno longer exists)�warnings�catch_warnings�simplefilterr �len� assertTrue� issubclass�category�DeprecationWarning�assertIn�str)r �caught�warnings r �edge_deprecation_errorz&TestNameLookups.edge_deprecation_errorY s� � �� � � $� $�D� 1� <�V��!�!�(�+�����S��[�!�,��J�W��O�O�J�w�'7�'7�9K�L�M��M�M�,�c�'�l�;� <� <� <�s �B+�A=B� B+�B(�$B+c � � | j t t j j � � | j � | j t t j j � � | j � y r )r r0 r � service_roots�keysr1 � web_rootsr2 s r �test_short_namesz TestNameLookups.test_short_namesf sP � ������ 2� 2� 7� 7� 9�:�D�L�L�I�������� 3� 3� 5�6����Er c � � | j � 5 | j t j d� t j d� � d d d � y # 1 sw Y y xY w�Nr/ r) �rE r r �lookup_service_rootr2 s r �$test_edge_service_root_is_productionz4TestNameLookups.test_edge_service_root_is_productionk sO � � � (� (� *� �����(�(��0��(�(��6� � � � �� �9A�Ac � � | j � 5 | j t j d� t j d� � d d d � y # 1 sw Y y xY wrL �rE r r �lookup_web_rootr2 s r � test_edge_web_root_is_productionz0TestNameLookups.test_edge_web_root_is_productiont sO � � � (� (� *� �����$�$�V�,��$�$�\�2� � � � �rP c �� � | j � 5 | j t j t j � t j d� � d d d � y # 1 sw Y y xY w�Nr) �rE r r rN �EDGE_SERVICE_ROOTr2 s r �-test_edge_service_root_url_becomes_productionz=TestNameLookups.test_edge_service_root_url_becomes_production} �S � � � (� (� *� �����(�(��)?�)?�@��(�(��6� � � � �� �AA!�!A*c �� � | j � 5 | j t j t j � t j d� � d d d � y # 1 sw Y y xY wrV )rE r r rS � EDGE_WEB_ROOTr2 s r �)test_edge_web_root_url_becomes_productionz9TestNameLookups.test_edge_web_root_url_becomes_production� sS � � � (� (� *� �����$�$�T�%7�%7�8��$�$�\�2� � � � �r[ c �� � | j � 5 | j t j t j � t j d� � d d d � y # 1 sw Y y xY wrV rW r2 s r �/test_top_level_edge_constant_becomes_productionz?TestNameLookups.test_top_level_edge_constant_becomes_production� rZ r[ c � � | j � 5 | j t j d� t j d� � d d d � y # 1 sw Y y xY w)Nzhttps://api.edge.launchpad.net/r) rM r2 s r �5test_edge_server_equivalent_string_becomes_productionzETestNameLookups.test_edge_server_equivalent_string_becomes_production� sN � � � (� (� *� �����(�(�)J�K��(�(��6� � � � �rP c � � | j � 5 | j t j d� t j d� � d d d � y # 1 sw Y y xY w)Nzhttps://edge.launchpad.net/r) rR r2 s r �9test_edge_web_server_equivalent_string_becomes_productionzITestNameLookups.test_edge_web_server_equivalent_string_becomes_production� sN � � � (� (� *� �����$�$�%B�C��$�$�\�2� � � � �rP c �� � | j � 5 | j D ]8 }| j t j |� t j | � �: ddd� | j � 5 | j D ]8 }| j t j |� t j | � �: ddd� d}| j t j |� |� | j t j |� |� d}| j t t j |� | j t t j |� y# 1 sw Y ��xY w# 1 sw Y ��xY w)z=Ensure that short service names turn into long service names.Nzhttp://some-other-server.comz not-a-url) rE r1 r r rN rG rS rI �assertRaises� ValueError)r �alias� other_root� not_a_urls r �test_lookupszTestNameLookups.test_lookups� s2 � � � (� (� *� ���� ��� � ��,�,�U�3�T�5G�5G��5N�� � � � (� (� *� ���� ��� � ��(�(��/�����1F�� � � 4� �����1�1�*�=�z�J�����-�-�j�9�:�F� � ����*�d�&>�&>� �J����*�d�&:�&:�I�F�+ � �� � �s �AE�2AE)�E&�)E2N)r! r"