Ë
    Dâ»cTJ  ã                   ó†   — d dl m Z  d dlmZ d dlmZmZmZmZ d dlm	Z	m
Z
  G d„ de«      Z G d„ de«      Z G d	„ d
e«      Zy)é    )Údatetime)ÚResourcedTestCase)ÚFakeLaunchpadÚFakeResourceÚFakeRootÚIntegrityError)ÚFakeLaunchpadResourceÚget_applicationc                   ó   — e Zd Zd„ Zy)ÚFakeRootTestc                 óh   — t        t        «       «      }| j                  t        |t        «      «       y ©N)r   r
   Ú
assertTrueÚ
isinstancer   )ÚselfÚroot_resources     úK/usr/lib/python3/dist-packages/launchpadlib/testing/tests/test_launchpad.pyÚtest_create_root_resourcez&FakeRootTest.test_create_root_resource$   s"   € Ü ¤Ó!2Ó3ˆØ�‰œ
 =´,Ó?Õ@ó    N)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r   r   #   s   „ óAr   r   c                   ó8   — e Zd Zd e«       fgZd„ Zd„ Zd„ Zd„ Zy)ÚFakeResourceTestÚ	launchpadc                 óò   — t        «       }t        |g¬«      | j                  _        t        | j                  j                  «      \  }| j	                  dt        t        |«      «      z  t        |«      «       y)z3A custom C{__repr__} is provided for L{FakeEntry}s.©Úentriesz<FakeEntry bug object at %s>N©Údictr   ÚbugsÚlistÚassertEqualÚhexÚidÚrepr©r   Úbugs     r   Útest_repr_entryz FakeResourceTest.test_repr_entry-   sV   € ä‹fˆÜ"¨C¨5Ô1ˆ�‰ÔÜ�T—^‘^×(Ñ(Ó)‰ˆØ×ÑØ*¬S´°C³«\Ñ9¼4À»9õ	
r   c                 ó  ‡— t        d¬«      Št        ˆfd„¬«      | j                  _        | j                  j                  j                  g «      Št	        t        ‰«      «      }| j                  d|z  t        ‰«      «       y)z8A custom C{__repr__} is provided for L{FakeCollection}s.útest-branch©Ú
total_sizec                 ó   •— ‰S r   r   ©ÚstatusesÚbranchess    €r   ú<lambda>z7FakeResourceTest.test_repr_collection.<locals>.<lambda>9   ó   ø€ ¸h€ r   ©ÚgetBranchesz2<FakeCollection branch-page-resource object at %s>N)r!   r   Úmer6   r%   r&   r$   r'   )r   Úobj_idr2   s     @r   Útest_repr_collectionz%FakeResourceTest.test_repr_collection6   sd   ø€ ä =Ô1ˆÜ Ó-FÔGˆ�‰ÔØ—>‘>×$Ñ$×0Ñ0°Ó4ˆÜ”R˜“\Ó"ˆØ×ÑØ@À6ÑIÜ�‹Nõ	
r   c                 óÆ   — t        d¬«      | j                  _        | j                  j                  }| j                  dt	        t        |«      «      z  t        |«      «       y)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!   r   r7   r$   r%   r&   r'   ©r   Úpersons     r   Útest_repr_with_namez$FakeResourceTest.test_repr_with_nameA   sH   € ô
 ! eÔ,ˆ�‰ÔØ—‘×"Ñ"ˆØ×ÑØ*¬S´°F³«_Ñ<¼dÀ6»lõ	
r   c                 óø   — t        dd¬«      }t        |g¬«      | j                  _        t        | j                  j                  «      \  }| j	                  dt        t        |«      «      z  t        |«      «       y)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&   Útitler   z<FakeEntry bug 1 at %s>Nr    r(   s     r   Útest_repr_with_idz"FakeResourceTest.test_repr_with_idL   s[   € ô
 �c Ô*ˆÜ"¨C¨5Ô1ˆ�‰ÔÜ�T—^‘^×(Ñ(Ó)‰ˆØ×ÑÐ2´S¼¸C»³\ÑAÄ4ÈÃ9ÕMr   N)	r   r   r   r	   Ú	resourcesr*   r9   r@   rF   r   r   r   r   r   )   s(   „ àÑ4Ó6Ð7Ð8€Iò
ò	
ò	
óNr   r   c                   ó  — e Zd Zd e«       fgZd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d „ Z#d!„ Z$d"„ Z%d#„ Z&d$„ Z'd%„ Z(d&„ Z)d'„ Z*d(„ Z+d)„ Z,d*„ Z-d+„ Z.y,)-ÚFakeLaunchpadTestr   c                 ó®   — t        «       }t        |«      }| j                  ||j                  «       | j                  t	        «       |j
                  «       y)zy
        The builtin WADL definition is used if the C{application} is not
        provided during instantiation.
        N)Úobjectr   r$   Úcredentialsr
   Ú_application©r   rL   r   s      r   Ú'test_wb_instantiate_without_applicationz9FakeLaunchpadTest.test_wb_instantiate_without_application[   sD   € ô
 “hˆÜ! +Ó.ˆ	Ø×Ñ˜ i×&;Ñ&;Ô<Ø×ÑœÓ*¨I×,BÑ,BÕCr   c           	      ó‚   — t        «       }t        |ddddt        «       ¬«      }| j                  ||j                  «       y)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©rK   r   r
   r$   rL   rN   s      r   Ú test_instantiate_with_everythingz2FakeLaunchpadTest.test_instantiate_with_everythinge   sB   € ô “hˆÜ!ØØØØØÜ'Ó)ô
ˆ	ð 	×Ñ˜ i×&;Ñ&;Õ<r   c                 óz   — t        «       }t        |t        «       ¬«      }| j                  ||j                  «       y)z8A L{FakeLaunchpad} can be instantiated with credentials.)rU   NrV   rN   s      r   Ú!test_instantiate_with_credentialsz3FakeLaunchpadTest.test_instantiate_with_credentialsv   s.   € ä“hˆÜ! +¼?Ó;LÔMˆ	Ø×Ñ˜ i×&;Ñ&;Õ<r   c                 óN   — | j                  | j                  j                  «       y)z~
        A L{FakeLaunchpad} instantiated without credentials has its
        C{credentials} attribute set to C{None}.
        N)ÚassertIsNoner   rL   ©r   s    r   Ú$test_instantiate_without_credentialsz6FakeLaunchpadTest.test_instantiate_without_credentials|   s   € ð
 	×Ñ˜$Ÿ.™.×4Ñ4Õ5r   c                 óR   — | j                  t        t        | j                  dd«       y)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   Úsetattrr   r\   s    r   Útest_set_undefined_propertyz-FakeLaunchpadTest.test_set_undefined_propertyƒ   s!   € ð
 	×ÑÜœG T§^¡^°U¸Eõ	
r   c                 óš   — t        d¬«      | j                  _        | j                  t        t
        | j                  j                  d«       y)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!   r   r7   r`   ÚAttributeErrorÚgetattrr\   s    r   Útest_get_undefined_resourcez-FakeLaunchpadTest.test_get_undefined_resourceŒ   s3   € ô
 !¨eÔ4ˆ�‰ÔØ×Ñœ.¬'°4·>±>×3DÑ3DÀfÕMr   c                 óš   — t        d¬«      | j                  _        | j                  d| j                  j                  j                  «       y)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!   r   r7   r$   r=   r\   s    r   Útest_string_propertyz&FakeLaunchpadTest.test_string_property”   s5   € ô ! eÔ,ˆ�‰ÔØ×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Õ7r   c                 óš   — t        d¬«      | j                  _        | j                  d| j                  j                  j                  «       y)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<   Nrj   r\   s    r   Útest_unicode_propertyz'FakeLaunchpadTest.test_unicode_property�   s5   € ô ! fÔ-ˆ�‰ÔØ×Ñ˜ §¡×!2Ñ!2×!7Ñ!7Õ8r   c                 óÂ   — t        j                  «       }t        |¬«      | j                  _        | j                  || j                  j                  j                  «       y)zU
        Attributes that represent dates are set with C{datetime} instances.
        ©Údate_createdN)r   Úutcnowr!   r   r7   r$   rp   )r   Únows     r   Útest_datetime_propertyz(FakeLaunchpadTest.test_datetime_property¦   sA   € ô �o‰oÓˆÜ ¨cÔ2ˆ�‰ÔØ×Ñ˜˜dŸn™n×/Ñ/×<Ñ<Õ=r   c           	      óf   — | j                  t        t        | j                  dt	        d¬«      «       y)z
        Only C{datetime} values can be set on L{FakeLaunchpad} instances for
        attributes that represent dates.
        r7   rr   ro   N©r`   r   ra   r   r!   r\   s    r   Útest_invalid_datetime_propertyz0FakeLaunchpadTest.test_invalid_datetime_property®   s*   € ð
 	×ÑÜÜØ�N‰NØÜ˜eÔ$õ	
r   c                 óü   — t        dd¬«      | j                  _        | j                  d| j                  j                  j                  «       | j                  d| j                  j                  j
                  «       y)z~
        Sample data can be created by setting L{FakeLaunchpad} attributes with
        dicts that represent objects.
        r;   rd   )r=   re   N)r!   r   r7   r$   r=   re   r\   s    r   Útest_multiple_string_propertiesz1FakeLaunchpadTest.test_multiple_string_properties»   sW   € ô
 ! e¸%Ô@ˆ�‰ÔØ×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Ô7Ø×Ñ˜ §¡× 1Ñ 1× >Ñ >Õ?r   c           	      óf   — | j                  t        t        | j                  dt	        d¬«      «       y)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.
        r7   r_   ©r;   Nru   r\   s    r   Útest_invalid_property_namez,FakeLaunchpadTest.test_invalid_property_nameÄ   s%   € ð 	×ÑÜœG T§^¡^°T¼4ÀE¼?õ	
r   c           	      óf   — | j                  t        t        | j                  dt	        d¬«      «       y)z—
        The types of sample data values set on L{FakeLaunchpad} instances are
        validated against types defined in the WADL definition.
        r7   éf   r<   Nru   r\   s    r   Útest_invalid_property_valuez-FakeLaunchpadTest.test_invalid_property_valueÎ   s%   € ð
 	×ÑÜœG T§^¡^°T¼4ÀS¼>õ	
r   c                 óÄ   ‡— t        d¬«      Št        ˆfd„¬«      | j                  _        | j                  d| j                  j                  j	                  g «      «       y)z˜
        A callable set on a L{FakeLaunchpad} instance is validated against the
        WADL definition, to make sure a matching method exists.
        r,   r-   c                 ó   •— ‰S r   r   r0   s    €r   r3   z1FakeLaunchpadTest.test_callable.<locals>.<lambda>Ý   r4   r   r5   N)r!   r   r7   ÚassertNotEqualr6   ©r   r2   s    @r   Útest_callablezFakeLaunchpadTest.test_callable×   sF   ø€ ô
  =Ô1ˆÜ Ó-FÔGˆ�‰ÔØ×Ñ˜D $§.¡.×"3Ñ"3×"?Ñ"?ÀÓ"CÕDr   c           	      óh   — | j                  t        t        | j                  dt	        d„ ¬«      «       y)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.
        r7   c                   ó   — y r   r   r   r   r   r3   z>FakeLaunchpadTest.test_invalid_callable_name.<locals>.<lambda>ê   ó   � r   rz   Nru   r\   s    r   Útest_invalid_callable_namez,FakeLaunchpadTest.test_invalid_callable_nameà   s*   € ð
 	×ÑÜÜØ�N‰NØÜ‘\Ô"õ	
r   c                 ó  ‡— t        d¬«      Št        ˆfd„¬«      | j                  _        | j                  j                  j                  g «      Š| j	                  t        ‰t        «      «       | j                  d‰j                  «       y)z“
        The result of a fake method is a L{FakeResource}, automatically
        created from the object used to define the return object.
        Ú8r-   c                 ó   •— ‰S r   r   r0   s    €r   r3   zDFakeLaunchpadTest.test_callable_object_return_type.<locals>.<lambda>ó   r4   r   r5   N)	r!   r   r7   r6   r   r   r   r$   r.   r‚   s    @r   Ú test_callable_object_return_typez2FakeLaunchpadTest.test_callable_object_return_typeí   sd   ø€ ô
  3Ô'ˆÜ Ó-FÔGˆ�‰ÔØ—>‘>×$Ñ$×0Ñ0°Ó4ˆØ�‰œ
 8¬\Ó:Ô;Ø×Ñ˜˜h×1Ñ1Õ2r   c                 óÄ   ‡— t        d¬«      Št        ˆfd„¬«      | j                  _        | j                  t        | j                  j                  j
                  g «       y)zW
        An L{IntegrityError} is raised if a method returns an invalid result.
        é   r-   c                 ó   •— ‰S r   r   r0   s    €r   r3   zLFakeLaunchpadTest.test_invalid_callable_object_return_type.<locals>.<lambda>ý   r4   r   r5   N)r!   r   r7   r`   r   r6   r‚   s    @r   Ú(test_invalid_callable_object_return_typez:FakeLaunchpadTest.test_invalid_callable_object_return_typeø   sC   ø€ ô  1Ô%ˆÜ Ó-FÔGˆ�‰ÔØ×Ñœ.¨$¯.©.×*;Ñ*;×*GÑ*GÈÕLr   c                 ó¤   — t        d„ ¬«      | j                  _        | j                  | j                  j                  j	                  d«      «       y)z}
        A fake method passes through a return value of None rather than
        trying to create a L{FakeResource}.
        c                  ó   — y r   r   r<   s    r   r3   zDFakeLaunchpadTest.test_callable_object_return_None.<locals>.<lambda>  r†   r   ©ÚgetByUniqueNamer;   N)r!   r   r2   r[   r“   r\   s    r   Ú test_callable_object_return_Nonez2FakeLaunchpadTest.test_callable_object_return_None   s9   € ô
 #'Ñ7HÔ"Iˆ�‰ÔØ×Ñ˜$Ÿ.™.×1Ñ1×AÑAÀ%ÓHÕIr   c                 óä   ‡— t        d„ ¬«      Št        ˆfd„¬«      | j                  _        | j                  j                  j                  d«      Š| j	                  ‰j                  «       «       y)z¶
        If the WADL definition of a method does not include a response
        representation, then fake versions of that method just pass through
        the return value.
        c                   ó   — y)NTr   r   r   r   r3   zSFakeLaunchpadTest.test_callable_object_no_response_representation.<locals>.<lambda>  r†   r   )ÚcanBeDeletedc                 ó   •— ‰S r   r   ©r=   Úbranchs    €r   r3   zSFakeLaunchpadTest.test_callable_object_no_response_representation.<locals>.<lambda>  ó   ø€ ÀF€ r   r’   r;   N)r!   r   r2   r“   r   r—   ©r   rš   s    @r   Ú/test_callable_object_no_response_representationzAFakeLaunchpadTest.test_callable_object_no_response_representation  sP   ø€ ô ¡<Ô0ˆÜ"&Ó7JÔ"Kˆ�‰ÔØ—‘×(Ñ(×8Ñ8¸Ó?ˆØ�‰˜×+Ñ+Ó-Õ.r   c                 óæ   — t        t        d¬«      ¬«      }t        |g¬«      | j                  _        | j                  j                  d   }| j                  d|j                  j
                  «       y)zx
        Attributes that represent links to other objects are set using a
        dict representing the object.
        ztest-personr<   ©Úownerr   r   N)r!   r   r"   r$   r    r=   r(   s     r   Útest_entry_propertyz%FakeLaunchpadTest.test_entry_property  sR   € ô
 œ =Ô1Ô2ˆÜ"¨C¨5Ô1ˆ�‰ÔØ�n‰n×!Ñ! !Ñ$ˆØ×Ñ˜¨¯	©	¯©Õ7r   c           	      ó”   — t        t        d¬«      ¬«      }| j                  t        t        | j                  dt        |g¬«      «       y)z>
        Sample data for linked entries is validated.
        r_   rz   rŸ   r"   r   N©r!   r`   r   ra   r   r(   s     r   Útest_invalid_entry_propertyz-FakeLaunchpadTest.test_invalid_entry_property  s:   € ô œ %œÔ)ˆØ×ÑÜÜØ�N‰NØÜ˜#˜Ôõ	
r   c                 óÜ   ‡— t        d¬«      Št        ˆfd„¬«      | j                  _        | j                  j                  j                  d«      Š| j	                  d‰j
                  «       y)z©
        Sample top-level collections can be set on L{FakeLaunchpad}
        instances.  They are validated the same way other sample data is
        validated.
        r;   r<   c                 ó   •— ‰S r   r   r™   s    €r   r3   zFFakeLaunchpadTest.test_top_level_collection_property.<locals>.<lambda>1  r›   r   r’   N)r!   r   r2   r“   r$   r=   rœ   s    @r   Ú"test_top_level_collection_propertyz4FakeLaunchpadTest.test_top_level_collection_property*  sO   ø€ ô ˜5Ô!ˆÜ"&Ó7JÔ"Kˆ�‰ÔØ—‘×(Ñ(×8Ñ8¸Ó?ˆØ×Ñ˜ §¡Õ,r   c                 ó8  ‡— t        d¬«      }t        t        |g¬«      ¬«      Št        ˆfd„¬«      | j                  _        | j                  j                  j                  d«      Št	        ‰j
                  «      \  }| j                  d|j                  «       y)	z‹
        Attributes that represent links to collections of other objects are
        set using a dict representing the collection.
        rB   )r&   r   ©Úlinked_bugsc                 ó   •— ‰S r   r   r™   s    €r   r3   z<FakeLaunchpadTest.test_collection_property.<locals>.<lambda><  r›   r   r’   r;   N)r!   r   r2   r“   r#   rª   r$   r&   ©r   r)   rš   s     @r   Útest_collection_propertyz*FakeLaunchpadTest.test_collection_property5  sq   ø€ ô
 �cŒlˆÜ¤$°¨uÔ"5Ô6ˆÜ"&Ó7JÔ"Kˆ�‰ÔØ—‘×(Ñ(×8Ñ8¸Ó?ˆÜ�V×'Ñ'Ó(‰ˆØ×Ñ˜˜cŸf™fÕ%r   c                 óD  — t        dd¬«      }t        |g¬«      | j                  _        t        | j                  j                  «      }| j	                  dt        |«      «       |d   }| j	                  d|j                  «       | j	                  d|j                  «       y)z�
        Data for a sample collection set on a L{FakeLaunchpad} instance can be
        iterated over if an C{entries} key is defined.
        rB   rC   rD   r   é   r   N)r!   r   r"   r#   r$   Úlenr&   rE   )r   r)   r"   s      r   Útest_iterate_collectionz)FakeLaunchpadTest.test_iterate_collectionA  s|   € ô
 �c Ô*ˆÜ"¨C¨5Ô1ˆ�‰ÔÜ�D—N‘N×'Ñ'Ó(ˆØ×Ñ˜œC ›IÔ&Ø�1‰gˆØ×Ñ˜˜cŸf™fÔ%Ø×Ñ˜ 3§9¡9Õ-r   c           	      ó€   — t        d¬«      }| j                  t        t        | j                  dt        |g¬«      «       y)z
        Sample data for each entry in a collection is validated when it's set
        on a L{FakeLaunchpad} instance.
        r_   rz   r"   r   Nr£   r(   s     r   Ú.test_top_level_collection_with_invalid_entriesz@FakeLaunchpadTest.test_top_level_collection_with_invalid_entriesN  s5   € ô
 �uŒoˆØ×ÑÜÜØ�N‰NØÜ˜#˜Ôõ	
r   c                 óò   ‡— t        d¬«      }t        t        |g¬«      ¬«      Št        ˆfd„¬«      | j                  _        | j                  t        | j                  j                  j
                  d«       y)	zŸ
        Sample data for each entry in a collection is validated when it's set
        on an attribute representing a link to a collection of objects.
        r_   rz   r   r©   c                 ó   •— ‰S r   r   r™   s    €r   r3   zHFakeLaunchpadTest.test_collection_with_invalid_entries.<locals>.<lambda>c  r›   r   r’   r;   N)r!   r   r2   r`   r   r“   r¬   s     @r   Ú$test_collection_with_invalid_entriesz6FakeLaunchpadTest.test_collection_with_invalid_entries\  sX   ø€ ô
 �uŒoˆÜ¤$°¨uÔ"5Ô6ˆÜ"&Ó7JÔ"Kˆ�‰ÔØ×ÑÜØ�N‰N×#Ñ#×3Ñ3Øõ	
r   c                 ór  — t        dd¬«      }t        dd¬«      }t        dd¬«      }t        |||g¬«      | j                  _        | j                  j                  d	d
 }| j                  dt	        |«      «       | j                  d|d   j
                  «       | j                  d|d	   j
                  «       y)zˆ
        Data for a sample collection set on a L{FakeLaunchpad} instance can be
        sliced if an C{entries} key is defined.
        rB   rC   rD   Ú2úBug #2Ú3zBug #3r   r¯   é   é   r   N)r!   r   r"   r$   r°   r&   )r   Úbug1Úbug2Úbug3r"   s        r   Útest_slice_collectionz'FakeLaunchpadTest.test_slice_collectionj  sš   € ô
 �s (Ô+ˆÜ�s (Ô+ˆÜ�s (Ô+ˆÜ"¨D°$¸Ð+=Ô>ˆ�‰ÔØ�~‰~×"Ñ" 1 QÐ'ˆØ×Ñ˜œC ›IÔ&Ø×Ñ˜˜d 1™gŸj™jÔ)Ø×Ñ˜˜d 1™gŸj™jÕ)r   c                 óØ   ‡ — t        dd¬«      }t        dd¬«      }t        ||g¬«      ‰ j                  _        ‰ j                  t        ˆ fd„«       ‰ j                  t        ˆ fd„«       y	)
zš
        A C{ValueError} is raised if a negative start value is used when
        slicing a sample collection set on a L{FakeLaunchpad} instance.
        rB   rC   rD   r¸   r¹   r   c                  ó6   •— ‰ j                   j                  dd  S ©Néÿÿÿÿ©r   r"   r\   s   €r   r3   zMFakeLaunchpadTest.test_slice_collection_with_negative_start.<locals>.<lambda>€  s   ø€ ¨d¯n©n×.AÑ.AÀ"À#Ð.F€ r   c                  ó6   •— ‰ j                   j                  dd S )NrÄ   r¼   rÅ   r\   s   €r   r3   zMFakeLaunchpadTest.test_slice_collection_with_negative_start.<locals>.<lambda>�  s   ø€ ¨d¯n©n×.AÑ.AÀ"ÀQÐ.G€ r   N©r!   r   r"   r`   Ú
ValueError©r   r½   r¾   s   `  r   Ú)test_slice_collection_with_negative_startz;FakeLaunchpadTest.test_slice_collection_with_negative_startx  óT   ø€ ô
 �s (Ô+ˆÜ�s (Ô+ˆÜ"¨D°$¨<Ô8ˆ�‰ÔØ×Ñœ*Ó&FÔGØ×Ñœ*Ó&GÕHr   c                 óØ   ‡ — t        dd¬«      }t        dd¬«      }t        ||g¬«      ‰ j                  _        ‰ j                  t        ˆ fd„«       ‰ j                  t        ˆ fd„«       y	)
z™
        A C{ValueError} is raised if a negative stop value is used when
        slicing a sample collection set on a L{FakeLaunchpad} instance.
        rB   rC   rD   r¸   r¹   r   c                  ó6   •— ‰ j                   j                  d d S rÃ   rÅ   r\   s   €r   r3   zLFakeLaunchpadTest.test_slice_collection_with_negative_stop.<locals>.<lambda>‹  s   ø€ ¨d¯n©n×.AÑ.AÀ#À2Ð.F€ r   c                  ó6   •— ‰ j                   j                  dd S )Nr   rÄ   rÅ   r\   s   €r   r3   zLFakeLaunchpadTest.test_slice_collection_with_negative_stop.<locals>.<lambda>Œ  s   ø€ ¨d¯n©n×.AÑ.AÀ!ÀBÐ.G€ r   NrÇ   rÉ   s   `  r   Ú(test_slice_collection_with_negative_stopz:FakeLaunchpadTest.test_slice_collection_with_negative_stopƒ  rË   r   c                 óŠ   ‡ — t        dd¬«      }t        |g¬«      ‰ j                  _        ‰ j                  t        ˆ fd„«       y)z
        An C{IndexError} is raised if an invalid index is used when retrieving
        data from a sample collection.
        rB   rC   rD   r   c                  ó6   •— ‰ j                   j                  d   S )Nr¼   rÅ   r\   s   €r   r3   zHFakeLaunchpadTest.test_subscript_operator_out_of_range.<locals>.<lambda>•  s   ø€ ¨d¯n©n×.AÑ.AÀ!Ñ.D€ r   N)r!   r   r"   r`   Ú
IndexError)r   r½   s   ` r   Ú$test_subscript_operator_out_of_rangez6FakeLaunchpadTest.test_subscript_operator_out_of_rangeŽ  s5   ø€ ô
 �s (Ô+ˆÜ"¨D¨6Ô2ˆ�‰ÔØ×Ñœ*Ó&DÕEr   c                 óD  — t        d¬«      | j                  _        | j                  j                  }| j                  d|j                  «       d|_        | j                  d|j                  «       | j                  d| j                  j                  j                  «       y)z<Values already set on fake resource objects can be replaced.r;   r<   r_   Nrj   r>   s     r   Útest_replace_propertyz'FakeLaunchpadTest.test_replace_property—  sq   € ä  eÔ,ˆ�‰ÔØ—‘×"Ñ"ˆØ×Ñ˜ §¡Ô,ØˆŒØ×Ñ˜ §¡Ô,Ø×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Õ7r   c                 ó6  ‡‡— t        dd¬«      Št        dd¬«      Št        ˆfd„¬«      | j                  _        ˆfd„| j                  j                  _        | j                  j                  j                  d«      }| j	                  d|j
                  «       y)	z=Methods already set on fake resource objects can be replaced.r;   zlp:~user/project/branch1)r=   Úbzr_identityzlp:~user/project/branch2c                 ó   •— ‰S r   r   )r=   Úbranch1s    €r   r3   z7FakeLaunchpadTest.test_replace_method.<locals>.<lambda>¤  s   ø€ ÀG€ r   r’   c                 ó   •— ‰S r   r   )r=   Úbranch2s    €r   r3   z7FakeLaunchpadTest.test_replace_method.<locals>.<lambda>¥  s   ø€ ¸w€ r   N)r!   r   r2   r“   r$   r×   )r   rš   rÙ   rÛ   s     @@r   Útest_replace_methodz%FakeLaunchpadTest.test_replace_method   sr   ù€ ä˜EÐ0JÔKˆÜ˜EÐ0JÔKˆÜ"&Ó7KÔ"Lˆ�‰ÔÛ2Fˆ�‰×ÑÔ/Ø—‘×(Ñ(×8Ñ8¸Ó?ˆØ×ÑÐ3°V×5HÑ5HÕIr   c                 ó    — t        d¬«      | j                  _        | j                  j                  }| j                  t        t
        |dd«       y)z2Values set on fake resource objects are validated.r;   r<   r=   r¯   N)r!   r   r7   r`   r   ra   r>   s     r   Ú(test_replace_property_with_invalid_valuez:FakeLaunchpadTest.test_replace_property_with_invalid_value©  s8   € ä  eÔ,ˆ�‰ÔØ—‘×"Ñ"ˆØ×Ñœ.¬'°6¸6À1ÕEr   c                 ó0  — t        d¬«      | j                  _        | j                  d| j                  j                  j                  «       t        d¬«      | j                  _        | j                  d| j                  j                  j                  «       y)z:Resources already set on L{FakeLaunchpad} can be replaced.r;   r<   r_   Nrj   r\   s    r   Útest_replace_resourcez'FakeLaunchpadTest.test_replace_resource¯  sd   € ä  eÔ,ˆ�‰ÔØ×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Ô7Ü  eÔ,ˆ�‰ÔØ×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Õ7r   c                 ó¤  — t        d¬«      | j                  _        | j                  j                  }d|_        | j	                  d|j
                  «       | j	                  d|j                  «       | j	                  d| j                  j                  j
                  «       | j	                  d| j                  j                  j                  «       y)z?Sample data set on a L{FakeLaunchpad} instance can be added to.r;   r<   rd   N)r!   r   r7   re   r$   r=   r>   s     r   Útest_add_propertyz#FakeLaunchpadTest.test_add_property¶  s”   € ä  eÔ,ˆ�‰ÔØ—‘×"Ñ"ˆØ#ˆÔØ×Ñ˜ §¡Ô,Ø×Ñ˜ × 3Ñ 3Ô4Ø×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Ô7Ø×Ñ˜ §¡× 1Ñ 1× >Ñ >Õ?r   c                 ó,  — t        «       | j                  _        | j                  t        t
        | j                  j                  d«       d| j                  j                  _        | j                  d| j                  j                  j                  «       y)z6An empty object can be used when creating sample data.r=   r;   N)r!   r   r7   r`   rf   rg   r=   r$   r\   s    r   Ú!test_add_property_to_empty_objectz3FakeLaunchpadTest.test_add_property_to_empty_objectÀ  s`   € ä ›Fˆ�‰ÔØ×Ñœ.¬'°4·>±>×3DÑ3DÀfÔMØ!&ˆ�‰×ÑÔØ×Ñ˜ §¡× 1Ñ 1× 6Ñ 6Õ7r   c                 óp   — t        j                  ddd«      }| j                  t        |t         «      «       y)z…
        L{FakeLaunchpad.login} ignores all parameters and returns a new
        instance using the builtin WADL definition.
        r=   ÚtokenÚsecretN)r   Úloginr   r   ©r   r   s     r   Ú
test_loginzFakeLaunchpadTest.test_loginÇ  s+   € ô
 "×'Ñ'¨°¸ÓBˆ	Ø�‰œ
 9¬mÓ<Õ=r   c                 ól   — t        j                  d«      }| j                  t        |t         «      «       y)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é   s     r   Útest_get_token_and_loginz*FakeLaunchpadTest.test_get_token_and_loginÏ  s'   € ô
 "×5Ñ5°fÓ=ˆ	Ø�‰œ
 9¬mÓ<Õ=r   c                 ól   — t        j                  d«      }| j                  t        |t         «      «       y)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é   s     r   Útest_login_withz!FakeLaunchpadTest.test_login_with×  s'   € ô
 "×,Ñ,¨VÓ4ˆ	Ø�‰œ
 9¬mÓ<Õ=r   c                 ó    — t        d¬«      | j                  _        | j                  | j                  j                  j	                  «       «       y)zU
        Sample object have an C{lp_save} method that is a no-op by default.
        r;   r<   N)r!   r   r7   r   Úlp_saver\   s    r   Útest_lp_savezFakeLaunchpadTest.test_lp_saveß  s4   € ô ! eÔ,ˆ�‰ÔØ�‰˜Ÿ™×)Ñ)×1Ñ1Ó3Õ4r   c                 ó¦   — t        dd„ ¬«      | j                  _        | j                  d| j                  j                  j	                  «       «       y)z;A custom C{lp_save} method can be set on a L{FakeResource}.r;   c                   ó   — y©NÚcustomr   r   r   r   r3   z7FakeLaunchpadTest.test_custom_lp_save.<locals>.<lambda>è  r†   r   )r=   rò   r÷   N)r!   r   r7   r$   rò   r\   s    r   Útest_custom_lp_savez%FakeLaunchpadTest.test_custom_lp_saveæ  s9   € ä  eÑ5EÔFˆ�‰ÔØ×Ñ˜ 4§>¡>×#4Ñ#4×#<Ñ#<Ó#>Õ?r   c                 óÚ   — t        d¬«      | j                  _        d„ | j                  j                  _        | j	                  d| j                  j                  j                  «       «       y)zl
        A custom C{lp_save} method can be set on a L{FakeResource} after its
        been created.
        r;   r<   c                   ó   — yrö   r   r   r   r   r3   z;FakeLaunchpadTest.test_set_custom_lp_save.<locals>.<lambda>ñ  r†   r   r÷   N)r!   r   r7   rò   r$   r\   s    r   Útest_set_custom_lp_savez)FakeLaunchpadTest.test_set_custom_lp_saveë  sJ   € ô
 ! eÔ,ˆ�‰ÔÙ$4ˆ�‰×ÑÔ!Ø×Ñ˜ 4§>¡>×#4Ñ#4×#<Ñ#<Ó#>Õ?r   N)/r   r   r   r	   rG   rO   rW   rY   r]   rb   rh   rk   rm   rs   rv   rx   r{   r~   rƒ   r‡   r‹   r�   r”   r�   r¡   r¤   r§   r­   r±   r³   r¶   rÀ   rÊ   rÏ   rÓ   rÕ   rÜ   rÞ   rà   râ   rä   rê   rí   rð   ró   rø   rû   r   r   r   rI   rI   W   só   „ àÑ4Ó6Ð7Ð8€IòDò=ò"=ò6ò
òNò8ò9ò>ò
ò@ò
ò
òEò
ò	3òMòJò	/ò8ò
ò	-ò
&ò.ò
ò
ò*ò	Iò	IòFò8òJòFò8ò@ò8ò>ò>ò>ò5ò@ó
@r   rI   N)r   Útestresourcesr   Úlaunchpadlib.testing.launchpadr   r   r   r   Úlaunchpadlib.testing.resourcesr	   r
   r   r   rI   r   r   r   ú<module>rÿ      sL   ðõ& å +÷ó ÷ôAÐ$ô Aô+NÐ(ô +Nô\[@Ð)õ [@r   