AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/launchpadlib/testing/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/launchpadlib/testing/tests/__pycache__/test_launchpad.cpython-310.pyc
o

Ʋ�a?�@stddlmZddlmZddlmZmZmZmZddlm	Z	m
Z
Gdd�de�ZGdd�de�ZGd	d
�d
e�Z
dS)�)�datetime)�ResourcedTestCase)�
FakeLaunchpad�FakeResource�FakeRoot�IntegrityError)�FakeLaunchpadResource�get_applicationc@seZdZdd�ZdS)�FakeRootTestcCstt��}|�t|t��dS�N)rr	�
assertTrue�
isinstancer)�self�
root_resource�r�K/usr/lib/python3/dist-packages/launchpadlib/testing/tests/test_launchpad.py�test_create_root_resource$s
z&FakeRootTest.test_create_root_resourceN)�__name__�
__module__�__qualname__rrrrrr
#sr
c@s0eZdZde�fgZdd�Zdd�Zdd�ZdS)	�FakeResourceTest�	launchpadcsRtdd��t�fdd�d�|j_|jj�g��tt���}|�d|t���dS)z6A custom C{__repr__} is provided for L{FakeResource}s.�test-branch��
total_sizec��Srr��statuses��branchesrr�<lambda>0�z,FakeResourceTest.test_repr.<locals>.<lambda>��getBranchesz0<FakeResource branch-page-resource object at %s>N)�dictr�mer#�hex�id�assertEqual�repr)r�obj_idrrr�	test_repr-s
�zFakeResourceTest.test_reprcCs6tdd�|j_|jj}|�dtt|��t|��dS)z�
        If the fake has a C{name} property it's included in the repr string to
        make it easier to figure out what it is.
        �foo��namez<FakeEntry person foo at %s>N)r$rr%r(r&r'r)�r�personrrr�test_repr_with_name8s
�z$FakeResourceTest.test_repr_with_namecCsJtddd�}t|gd�|j_t|jj�\}|�dtt|��t|��dS)z�
        If the fake has an C{id} property it's included in the repr string to
        make it easier to figure out what it is.
        �1�Bug #1�r'�title��entriesz<FakeResource bug 1 at %s>N)r$r�bugs�listr(r&r'r)�r�bugrrr�test_repr_with_idCs�z"FakeResourceTest.test_repr_with_idN)rrrr�	resourcesr+r1r<rrrrr)s
rc@s8eZdZde�fgZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJS)K�FakeLaunchpadTestrcCs0t�}t|�}|�||j�|�t�|j�dS)zy
        The builtin WADL definition is used if the C{application} is not
        provided during instantiation.
        N)�objectrr(�credentialsr	�_application�rr@rrrr�'test_wb_instantiate_without_applicationTsz9FakeLaunchpadTest.test_wb_instantiate_without_applicationcCs.t�}t|ddddt�d�}|�||j�dS)z�
        L{FakeLaunchpad} takes the same parameters as L{Launchpad} during
        instantiation, with the addition of an C{application} parameter.  The
        optional parameters are discarded when the object is instantiated.
        N)�service_root�cache�timeout�
proxy_info�application�r?rr	r(r@rBrrr� test_instantiate_with_everything^s�z2FakeLaunchpadTest.test_instantiate_with_everythingcCs&t�}t|t�d�}|�||j�dS)z8A L{FakeLaunchpad} can be instantiated with credentials.)rHNrIrBrrr�!test_instantiate_with_credentialsosz3FakeLaunchpadTest.test_instantiate_with_credentialscCs|�|jj�dS)z~
        A L{FakeLaunchpad} instantiated without credentials has its
        C{credentials} attribute set to C{None}.
        N)�assertIsNonerr@�rrrr�$test_instantiate_without_credentialsusz6FakeLaunchpadTest.test_instantiate_without_credentialscCs|�tt|jdd�dS)z�
        An L{IntegrityError} is raised if an attribute is set on a
        L{FakeLaunchpad} instance that isn't present in the WADL definition.
        r,�barN)�assertRaisesr�setattrrrMrrr�test_set_undefined_property|s�z-FakeLaunchpadTest.test_set_undefined_propertycCs&tdd�|j_|�tt|jjd�dS)z�
        An L{AttributeError} is raised if an attribute is accessed on a
        L{FakeLaunchpad} instance that doesn't exist.
        �Foo)�display_namer.N)r$rr%rP�AttributeError�getattrrMrrr�test_get_undefined_resource�sz-FakeLaunchpadTest.test_get_undefined_resourcecC�$tdd�|j_|�d|jjj�dS)z�
        Sample data can be created by setting L{FakeLaunchpad} attributes with
        dicts that represent objects.  Plain string values can be represented
        as C{str} values.
        r,r-N�r$rr%r(r.rMrrr�test_string_property��z&FakeLaunchpadTest.test_string_propertycCrX)z�
        Sample data can be created by setting L{FakeLaunchpad} attributes with
        dicts that represent objects.  Plain string values can be represented
        as C{unicode} strings.
        r,r-NrYrMrrr�test_unicode_property�r[z'FakeLaunchpadTest.test_unicode_propertycCs,t��}t|d�|j_|�||jjj�dS)zU
        Attributes that represent dates are set with C{datetime} instances.
        ��date_createdN)r�utcnowr$rr%r(r^)r�nowrrr�test_datetime_property�sz(FakeLaunchpadTest.test_datetime_propertyc	C�|�tt|jdtdd��dS)z
        Only C{datetime} values can be set on L{FakeLaunchpad} instances for
        attributes that represent dates.
        r%r`r]N�rPrrQrr$rMrrr�test_invalid_datetime_property�s�z0FakeLaunchpadTest.test_invalid_datetime_propertycCs8tddd�|j_|�d|jjj�|�d|jjj�dS)z~
        Sample data can be created by setting L{FakeLaunchpad} attributes with
        dicts that represent objects.
        r,rS)r.rTN)r$rr%r(r.rTrMrrr�test_multiple_string_properties�sz1FakeLaunchpadTest.test_multiple_string_propertiesc	Crb)z�
        Sample data set on a L{FakeLaunchpad} instance is validated against
        the WADL definition.  If a key is defined on a resource that doesn't
        match a related parameter, an L{IntegrityError} is raised.
        r%rO�r,NrcrMrrr�test_invalid_property_name�s�z,FakeLaunchpadTest.test_invalid_property_namec	Crb)z�
        The types of sample data values set on L{FakeLaunchpad} instances are
        validated against types defined in the WADL definition.
        r%�fr-NrcrMrrr�test_invalid_property_value�s�z-FakeLaunchpadTest.test_invalid_property_valuecs:tdd��t�fdd�d�|j_|�d|jj�g��dS)z�
        A callable set on a L{FakeLaunchpad} instance is validated against the
        WADL definition, to make sure a matching method exists.
        rrcrrrrrrrr �r!z1FakeLaunchpadTest.test_callable.<locals>.<lambda>r"N)r$rr%�assertNotEqualr#rMrrr�
test_callable�s
zFakeLaunchpadTest.test_callablec	Cs"|�tt|jdtdd�d��dS)z�
        An L{IntegrityError} is raised if a method is defined on a resource
        that doesn't match a method defined in the WADL definition.
        r%cSsdSrrrrrrr �r!z>FakeLaunchpadTest.test_invalid_callable_name.<locals>.<lambda>rfNrcrMrrr�test_invalid_callable_name�s�z,FakeLaunchpadTest.test_invalid_callable_namecsPtdd��t�fdd�d�|j_|jj�g��|�t�t��|�d�j�dS)z�
        The result of a fake method is a L{FakeResource}, automatically
        created from the object used to define the return object.
        �8rcrrrrrrrr �r!zDFakeLaunchpadTest.test_callable_object_return_type.<locals>.<lambda>r"N)	r$rr%r#rr
rr(rrMrrr� test_callable_object_return_type�s

z2FakeLaunchpadTest.test_callable_object_return_typecs8tdd��t�fdd�d�|j_|�t|jjjg�dS)zW
        An L{IntegrityError} is raised if a method returns an invalid result.
        �rcrrrrrrrr �r!zLFakeLaunchpadTest.test_invalid_callable_object_return_type.<locals>.<lambda>r"N)r$rr%rPrr#rMrrr�(test_invalid_callable_object_return_type�s
z:FakeLaunchpadTest.test_invalid_callable_object_return_typecs@tdd��t�fdd�d�|j_|jj�d��|�d�j�dS)z�
        Sample collections can be set on L{FakeLaunchpad} instances.  They are
        validated the same way other sample data is validated.
        r,r-crrrr-��branchrrr �r!z<FakeLaunchpadTest.test_collection_property.<locals>.<lambda>��getByUniqueNameN)r$rrrtr(r.rMrrqr�test_collection_property�s
z*FakeLaunchpadTest.test_collection_propertycCs`tddd�}t|gd�|j_t|jj�}|�dt|��|d}|�d|j�|�d|j�dS)z�
        Data for a sample collection set on a L{FakeLaunchpad} instance can be
        iterated over if an C{entries} key is defined.
        r2r3r4r6�rN)r$rr8r9r(�lenr'r5)rr;r8rrr�test_iterate_collectionsz)FakeLaunchpadTest.test_iterate_collectionc	Cs*tdd�}|�tt|jdt|gd��dS)z
        Sample data for each entry in a collection is validated when it's set
        on a L{FakeLaunchpad} instance.
        rOrfr8r6N)r$rPrrQrr:rrr�$test_collection_with_invalid_entriess

�z6FakeLaunchpadTest.test_collection_with_invalid_entriescCs�tddd�}tddd�}tddd�}t|||gd�|j_|jjd	d
�}|�dt|��|�d|dj�|�d|d	j�d
S)z�
        Data for a sample collection set on a L{FakeLaunchpad} instance can be
        sliced if an C{entries} key is defined.
        r2r3r4�2�Bug #2�3zBug #3r6rv��rN)r$rr8r(rwr')r�bug1�bug2�bug3r8rrr�test_slice_collectionsz'FakeLaunchpadTest.test_slice_collectionc�Vtddd�}tddd�}t||gd��j_��t�fdd����t�fd	d��d
S)z�
        A C{ValueError} is raised if a negative start value is used when
        slicing a sample collection set on a L{FakeLaunchpad} instance.
        r2r3r4rzr{r6cs�jjdd�S�N����rr8rrMrrr 4�zMFakeLaunchpadTest.test_slice_collection_with_negative_start.<locals>.<lambda>c��jjdd�S)Nr�r~r�rrMrrr 5r�N�r$rr8rP�
ValueError�rrr�rrMr�)test_slice_collection_with_negative_start,�
z;FakeLaunchpadTest.test_slice_collection_with_negative_startcr�)z�
        A C{ValueError} is raised if a negative stop value is used when
        slicing a sample collection set on a L{FakeLaunchpad} instance.
        r2r3r4rzr{r6cs�jjdd�Sr�r�rrMrrr ?r�zLFakeLaunchpadTest.test_slice_collection_with_negative_stop.<locals>.<lambda>cr�)Nrr�r�rrMrrr @r�Nr�r�rrMr�(test_slice_collection_with_negative_stop7r�z:FakeLaunchpadTest.test_slice_collection_with_negative_stopcs4tddd�}t|gd��j_��t�fdd��dS)z
        An C{IndexError} is raised if an invalid index is used when retrieving
        data from a sample collection.
        r2r3r4r6cs�jjdS)Nr~r�rrMrrr IszHFakeLaunchpadTest.test_subscript_operator_out_of_range.<locals>.<lambda>N)r$rr8rP�
IndexError)rrrrMr�$test_subscript_operator_out_of_rangeBsz6FakeLaunchpadTest.test_subscript_operator_out_of_rangecCsNtdd�|j_|jj}|�d|j�d|_|�d|j�|�d|jjj�dS)z<Values already set on fake resource objects can be replaced.r,r-rONrYr/rrr�test_replace_propertyKsz'FakeLaunchpadTest.test_replace_propertycs`tddd��tddd��t�fdd�d�|j_�fdd�|jj_|jj�d�}|�d|j�d	S)
z=Methods already set on fake resource objects can be replaced.r,zlp:~user/project/branch1)r.�bzr_identityzlp:~user/project/branch2crrrr-)�branch1rrr Xr!z7FakeLaunchpadTest.test_replace_method.<locals>.<lambda>rscrrrr-)�branch2rrr Yr!N)r$rrrtr(r�)rrrr)r�r�r�test_replace_methodTsz%FakeLaunchpadTest.test_replace_methodcCs,tdd�|j_|jj}|�tt|dd�dS)z2Values set on fake resource objects are validated.r,r-r.rvN)r$rr%rPrrQr/rrr�(test_replace_property_with_invalid_value]sz:FakeLaunchpadTest.test_replace_property_with_invalid_valuecCsDtdd�|j_|�d|jjj�tdd�|j_|�d|jjj�dS)z:Resources already set on L{FakeLaunchpad} can be replaced.r,r-rONrYrMrrr�test_replace_resourcecsz'FakeLaunchpadTest.test_replace_resourcecCs`tdd�|j_|jj}d|_|�d|j�|�d|j�|�d|jjj�|�d|jjj�dS)z?Sample data set on a L{FakeLaunchpad} instance can be added to.r,r-rSN)r$rr%rTr(r.r/rrr�test_add_propertyjsz#FakeLaunchpadTest.test_add_propertycCs>t�|j_|�tt|jjd�d|jj_|�d|jjj�dS)z6An empty object can be used when creating sample data.r.r,N)r$rr%rPrUrVr.r(rMrrr�!test_add_property_to_empty_objectts

z3FakeLaunchpadTest.test_add_property_to_empty_objectcCs"t�ddd�}|�t|t��dS)z�
        L{FakeLaunchpad.login} ignores all parameters and returns a new
        instance using the builtin WADL definition.
        r.�token�secretN)r�loginrr
�rrrrr�
test_login{szFakeLaunchpadTest.test_logincC�t�d�}|�t|t��dS)z�
        L{FakeLaunchpad.get_token_and_login} ignores all parameters and
        returns a new instance using the builtin WADL definition.
        r.N)r�get_token_and_loginrr
r�rrr�test_get_token_and_login��
z*FakeLaunchpadTest.test_get_token_and_logincCr�)z�
        L{FakeLaunchpad.login_with} ignores all parameters and returns a new
        instance using the builtin WADL definition.
        r.N)r�
login_withrr
r�rrr�test_login_with�r�z!FakeLaunchpadTest.test_login_withcCs$tdd�|j_|�|jj���dS)zU
        Sample object have an C{lp_save} method that is a no-op by default.
        r,r-N)r$rr%r�lp_saverMrrr�test_lp_save�szFakeLaunchpadTest.test_lp_savecCs,tddd�d�|j_|�d|jj���dS)z;A custom C{lp_save} method can be set on a L{FakeResource}.r,cS�dS�N�customrrrrrr �r!z7FakeLaunchpadTest.test_custom_lp_save.<locals>.<lambda>)r.r�r�N)r$rr%r(r�rMrrr�test_custom_lp_save�sz%FakeLaunchpadTest.test_custom_lp_savecCs4tdd�|j_dd�|jj_|�d|jj���dS)zl
        A custom C{lp_save} method can be set on a L{FakeResource} after its
        been created.
        r,r-cSr�r�rrrrrr �r!z;FakeLaunchpadTest.test_set_custom_lp_save.<locals>.<lambda>r�N)r$rr%r�r(rMrrr�test_set_custom_lp_save�sz)FakeLaunchpadTest.test_set_custom_lp_saveN))rrrrr=rCrJrKrNrRrWrZr\rardrergrirkrlrnrprurxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr>PsL
			
	
		


			
r>N)r�
testresourcesr�launchpadlib.testing.launchpadrrrr�launchpadlib.testing.resourcesrr	r
rr>rrrr�<module>s'

Anon7 - 2022
AnonSec Team