+
    Z4i                     |   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RIt^ RIHt ^ RIHt ^ R	IHtHtHtHtHtHtHt ^ R
IHt Rt ! R R]P@                  4      t! ! R R]P@                  4      t" ! R R]P@                  4      t# ! R R]P@                  4      t$ ! R R]P@                  4      t% ! R R]P@                  4      t& ! R R]P@                  4      t' ! R R]'4      t( ! R R]'4      t) ! R R]P@                  4      t* ! R  R!]P@                  4      t+R# )"zTests 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                   *   a  ] tR t^9t o RtR tRtV tR# )TestResourceTypeClassesz<launchpadlib must know about restfulclient's resource types.c                    \         P                  P                  4        F,  w  rV P                  \        P                  V,          V4       K.  	  R # N)r   RESOURCE_TYPE_CLASSESitemsassertEqualr   )selfnameclss   &  C/usr/lib/python3/dist-packages/launchpadlib/tests/test_launchpad.pytest_resource_types+TestResourceTypeClasses.test_resource_types<   s;     %::@@BIDY<<TBCH C     N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classdict__s   @r   r   r   9   s     FI Ir    r   c                   p   a  ] tR t^Ct o RtR t]R 4       tR tR t	R t
R tR tR	 tR
 tR tR tRtV tR# )TestNameLookupsz0Test the utility functions in the 'uris' module.c                *    \        . RO4      V n        R# )
productionN)r.   	qastagingstagingdogfooddevtest_devedge)sortedaliasesr   s   &r   setUpTestNameLookups.setUpF   s    

r    c              #    "   \         P                  ! R R7      ;_uu_ 4       p\         P                  ! R4       Rx  V P                  \	        V4      ^4       Vw  pV P                  \        VP                  \        4      4       V P                  R\        V4      4       RRR4       R#   + '       g   i     R# ; i5i)TrecordalwaysNzno longer exists)warningscatch_warningssimplefilterr   len
assertTrue
issubclasscategoryDeprecationWarningassertInstr)r   caughtwarnings   &  r   edge_deprecation_error&TestNameLookups.edge_deprecation_errorS   s      $$D11V!!(+S[!,JWOOJw'7'79KLMMM,c'l; 2111s    B>A>B* 
B>*B;	5	B>c                
   V P                  \        \        P                  P	                  4       4      V P
                  4       V P                  \        \        P                  P	                  4       4      V P
                  4       R # r   )r   r5   r   service_rootskeysr6   	web_rootsr7   s   &r   test_short_names TestNameLookups.test_short_names`   sP     2 2 7 7 9:DLLI 3 3 56Er    c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! R 4      \        P                  ! R4      4       RRR4       R#   + '       g   i     R# ; ir4   r.   NrJ   r   r   lookup_service_rootr7   s   &r   $test_edge_service_root_is_production4TestNameLookups.test_edge_service_root_is_productione   sL     ((**((0((6 +***   ;AA/	c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! R 4      \        P                  ! R4      4       RRR4       R#   + '       g   i     R# ; irS   rJ   r   r   lookup_web_rootr7   s   &r    test_edge_web_root_is_production0TestNameLookups.test_edge_web_root_is_productionn   sL     ((**$$V,$$\2 +***rX   c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! \        P                  4      \        P                  ! R 4      4       RRR4       R#   + '       g   i     R# ; ir.   NrJ   r   r   rU   EDGE_SERVICE_ROOTr7   s   &r   -test_edge_service_root_url_becomes_production=TestNameLookups.test_edge_service_root_url_becomes_productionw   P    ((**(()?)?@((6 +***   A	A,,A=	c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! \        P                  4      \        P                  ! R 4      4       RRR4       R#   + '       g   i     R# ; ir_   )rJ   r   r   r[   EDGE_WEB_ROOTr7   s   &r   )test_edge_web_root_url_becomes_production9TestNameLookups.test_edge_web_root_url_becomes_production~   sP    ((**$$T%7%78$$\2 +***re   c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! \        P                  4      \        P                  ! R 4      4       RRR4       R#   + '       g   i     R# ; ir_   r`   r7   s   &r   /test_top_level_edge_constant_becomes_production?TestNameLookups.test_top_level_edge_constant_becomes_production   rd   re   c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! R 4      \        P                  ! R4      4       RRR4       R#   + '       g   i     R# ; i)zhttps://api.edge.launchpad.net/r.   NrT   r7   s   &r   5test_edge_server_equivalent_string_becomes_productionETestNameLookups.test_edge_server_equivalent_string_becomes_production   sK    ((**(()JK((6 +***rX   c                    V P                  4       ;_uu_ 4        V P                  \        P                  ! R 4      \        P                  ! R4      4       RRR4       R#   + '       g   i     R# ; i)zhttps://edge.launchpad.net/r.   NrZ   r7   s   &r   9test_edge_web_server_equivalent_string_becomes_productionITestNameLookups.test_edge_web_server_equivalent_string_becomes_production   sK    ((**$$%BC$$\2 +***rX   c                D   V P                  4       ;_uu_ 4        V P                   F>  pV P                  \        P                  ! V4      \        P
                  V,          4       K@  	  RRR4       V P                  4       ;_uu_ 4        V P                   F>  pV P                  \        P                  ! V4      \        P                  V,          4       K@  	  RRR4       RpV P                  \        P                  ! V4      V4       V P                  \        P                  ! V4      V4       RpV P                  \        \        P                  V4       V P                  \        \        P                  V4       R#   + '       g   i     EL; i  + '       g   i     L; i)z=Ensure that short service names turn into long service names.Nzhttp://some-other-server.comz	not-a-url)
rJ   r6   r   r   rU   rM   r[   rO   assertRaises
ValueError)r   alias
other_root	not_a_urls   &   r   test_lookupsTestNameLookups.test_lookups   s#   
 ((**  ,,U3T5G5G5N & + ((**  ((/1F & + 4
11*=zJ--j9:F  	*d&>&>	J*d&:&:IF+ +** +*s   AE;AF;F	F	)r6   N)r"   r#   r$   r%   r&   r8   r   rJ   rP   rV   r\   rb   rh   rk   rn   rq   ry   r'   r(   r)   s   @r   r,   r,   C   sV     :
 
< 
<F
G Gr    r,   c                   *   a  ] tR t^t o RtR tRtV tR# )"TestServiceNameWithEmbeddedVersiona  Reject service roots that include the version at the end of the URL.

If the service root is "http://api.launchpad.net/beta/" and the
version is "beta", the launchpadlib constructor will raise an
exception.

This happens with scripts that were written against old versions
of launchpadlib. The alternative is to try to silently fix it (the
fix will eventually break as new versions of the web service are
released) or to go ahead and make a request to
http://api.launchpad.net/beta/beta/, and cause an unhelpful 404
error.
c           
        R p\         P                  R,          V,           p \        RRRW!R7       \        R4      h  \         d4   pT P                  \        T4      P                  R4      4        Rp?MRp?ii ; iTR,          pT P                  \        \        RRRTTR7       \        P                  p\         P                  R,          T,           R,           pT P                  \        \        RRRTR7       R# )zversion-foor0   N)service_rootversionz*Expected a ValueError that was not thrown!zoIt looks like you're using a service root that incorporates the name of the web service version ("version-foo")/r~   )r   rM   r   AssertionErrorru   rB   rG   
startswithrt   r   DEFAULT_VERSION)r   r   rootedefault_versions   &    r   'test_service_name_with_embedded_versionJTestServiceNameWithEmbeddedVersion.test_service_name_with_embedded_version   s      !!),w6	OdD$TK !!MNN  	OOA!!& 	 	 	 	
 -<<!!),>D	4t$ 	 	
s   < A:)A55A:r!   N)r"   r#   r$   r%   r&   r   r'   r(   r)   s   @r   r|   r|      s     &
 &
r    r|   c                   <   a  ] tR t^t o RtR tR tR tR tRt	V t
R# )#TestRequestTokenAuthorizationEnginez4Tests for the RequestTokenAuthorizationEngine class.c                D    V P                  \        \        \        4       R # r   rt   ru   r   SERVICE_ROOTr7   s   &r   test_app_must_be_identified?TestRequestTokenAuthorizationEngine.test_app_must_be_identified   s    4l	
r    c                (    \        \        R R7       R# r   application_nameNr   r   r7   s   &r   $test_application_name_identifies_appHTestRequestTokenAuthorizationEngine.test_application_name_identifies_app   s    $\FKr    c                (    \        \        R R7       R# r   consumer_nameNr   r7   s   &r   !test_consumer_name_identifies_appETestRequestTokenAuthorizationEngine.test_consumer_name_identifies_app   s    $\Hr    c                    V P                  \        \        \        R RR7       V P                  \        \        \        RRR7       R# )name1name2)r   r   r   Nr   r7   s   &r   #test_conflicting_app_identificationGTestRequestTokenAuthorizationEngine.test_conflicting_app_identification   sH    ($! 	 	
 	(#  	 	
r    r!   N)r"   r#   r$   r%   r&   r   r   r   r   r'   r(   r)   s   @r   r   r      s#     >

LI
 
r    r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )%TestLaunchpadLoginWithCredentialsFilei  z9Tests for Launchpad.login_with() with a credentials file.c                D   \         P                  ! 4       w  r\        P                  ! R VR7      p\        P
                  ! V4      pV P                  VP                  P                  VP                  P                  P                  4       \        P                  ! V4       R# )not important)r   credentials_fileN)tempfilemkstempr   
login_withr   load_from_pathr   consumerkeycredentialsosremove)r   ignorefilename	launchpadr   s   &    r   test_filename3TestLaunchpadLoginWithCredentialsFile.test_filename  sy    #++-&11,x
	 "00:  $$i&;&;&D&D&H&H	
 			(r    c                    \         P                  ! 4       w  r\        4       pV P                  \        \
        P                  R VVR7       \        P                  ! V4       R# )r   )r   r   credential_storeN)	r   r   r   rt   ru   r   r   r   r   )r   r   r   stores   &   r   +test_cannot_specify_both_filename_and_storeQTestLaunchpadLoginWithCredentialsFile.test_cannot_specify_both_filename_and_store#  sQ    #++-&()),%" 	 	
 			(r    r!   N)	r"   r#   r$   r%   r&   r   r   r'   r(   r)   s   @r   r   r     s     C
 
r    r   c                   &   a  ] tR tRt o R tRtV tR# )4TestLaunchpadLoginWithCredentialsFileFromEnvVariablei0  c                   \         P                  ! 4       w  rV\        P                  R &   \        P
                  ! RR7      pV P                  VP                  \        4       V P                  VP                  P                  V4       \        P                  ! R 4       \        P                  R  V P                  \        P                  P                  R 4      4       \        P                  ! V4       R# )LP_CREDENTIALS_FILEr   r   N)r   r   r   environr   r   assertIsInstancer   r	   r   r   unsetenvassertIsNonegetr   )r   r   r   r   s   &   r   r   BTestLaunchpadLoginWithCredentialsFileFromEnvVariable.test_filename4  s    #++-,4

()&11,
	 	&&(F	
 	33<<hG
)*JJ,-"**..)>?@
		(r    r!   N)r"   r#   r$   r%   r   r'   r(   r)   s   @r   r   r   0  s      r    r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )KeyringTestiI  z*Base class for tests that use the keyring.c                T    \        4        \        4       \        P                  n        R # r   )r
   r   launchpadlibr   keyringr7   s   &r   r8   KeyringTest.setUpL  s    #% ,;+<  (r    c                &    \         P                  =R # r   )r   r   r   r7   s   &r   tearDownKeyringTest.tearDownS  s    $$,r    r!   N)	r"   r#   r$   r%   r&   r8   r   r'   r(   r)   s   @r   r   r   I  s     4=- -r    r   c                      a a ] tR tRt oRtV 3R ltV 3R ltR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtVtV ;t# )TestLaunchpadLoginWithiX  z!Tests for Launchpad.login_with().c                X   < \         SV `  4        \        P                  ! 4       V n        R # r   )superr8   r   mkdtemptemp_dirr   	__class__s   &r   r8   TestLaunchpadLoginWith.setUp[  s     ((*r    c                d   < \         SV `  4        \        P                  ! V P                  4       R # r   )r   r   shutilrmtreer   r   s   &r   r   TestLaunchpadLoginWith.tearDown_  s    dmm$r    c                   \         P                  P                  V P                  R 4      p\        P
                  ! R\        VR7       V P                  \         P                  P                  V4      4       \         P                  P                  VR4      pV P                  \         P                  P                  V4      4       V P                  \         P                  P                  \         P                  P                  VR4      4      4       \         P                  P                  VR4      pV P                  \         P                  P                  V4      4       R# )r   r   r~   launchpadlib_dirapi.example.comcacher   N)
r   pathjoinr   r   r   r   rB   isdirassertFalse)r   r   service_pathcredentials_paths   &   r   test_dirs_created(TestLaunchpadLoginWith.test_dirs_createdc  s     77<<~F%%%-	
 	&678ww||$46GHl34 	bggll<&IJK 77<<mD'789r    c                J   \         P                  P                  V P                  R 4      p\         P                  ! V4       \         P
                  ! VR4       V P                  \         P                  P                  V4      4       \         P                  ! V4      p\        P                  ! VP                  4      pV P                  V\        P                  \        P                  ,          \        P                  ,          4       \        P                   ! R\"        VR7       \         P                  ! V4      p\        P                  ! VP                  4      pV P%                  V\        P                  \        P                  ,          \        P                  ,          4       R# )r   i  r   r   N)r   r   r   r   mkdirchmodrB   r   statS_IMODEst_modeassertNotEqualS_IWRITES_IREADS_IEXECr   r   r   r   r   r   statinfomodes   &   r   'test_dirs_created_are_changed_to_secure>TestLaunchpadLoginWith.test_dirs_created_are_changed_to_securez  s    77<<~F
!"
!5)&67877+,||H,,-D$--$,,">"MN%%%-	
 77+,||H,,-t}}t||;dllJKr    c                   \         P                  P                  V P                  R 4      p\        P
                  ! R\        VR7       V P                  \         P                  P                  V4      4       \         P                  ! V4      p\        P                  ! VP                  4      pV P                  V\        P                  \        P                  ,          \        P                  ,          4       R# )r   r   r   N)r   r   r   r   r   r   r   rB   r   r   r   r   r   r   r   r   r   s   &   r   test_dirs_created_are_secure3TestLaunchpadLoginWith.test_dirs_created_are_secure  s    77<<~F%%%-	

 	&67877+,||H,,-t}}t||;dllJKr    c                ^   \         P                  P                  V P                  R 4      p\        P
                  ! R\        VRR7      pV P                  VP                  R,          R4       \        P
                  ! R\        VRR7      pV P                  VP                  R,          R4       R# )r   r   foo)r~   r   r   r   barN)	r   r   r   r   r   r   r   r   passed_in_argsr   r   r   s   &  r   test_version_is_propagated1TestLaunchpadLoginWith.test_version_is_propagated  s     77<<~F&11%-	
	 	11)<eD '11%-	
	 	11)<eDr    c                   \         P                  P                  V P                  R 4      p\        P
                  ! R\        VR7      pV P                  VP                  P                  P                  R4       \        P
                  ! R\        VR7      pV P                  VP                  P                  P                  R4       R# )r   zvery importantr   N)r   r   r   r   r   r   r   r   r   r   r   r   s   &  r   #test_application_name_is_propagated:TestLaunchpadLoginWith.test_application_name_is_propagated  s    
 77<<~F&11%-
	
 	!!**;;=M	
 '11%-
	
 	!!**;;=M	
r    c                    \        \        R 4      p\        P                  ! VR7       V P	                  VP
                  ^4       V P	                  VP                  ^4       R# )application nameauthorization_engineN)r   r   r   r   r   request_tokens_obtainedaccess_tokens_obtainedr   engines   & r   'test_authorization_engine_is_propagated>TestLaunchpadLoginWith.test_authorization_engine_is_propagated  sK     .l<NO%%6B77;66:r    c                N    V P                  \        \        P                  4       R # r   )rt   ru   r   r   r7   s   &r   )test_login_with_must_identify_application@TestLaunchpadLoginWith.test_login_with_must_identify_application  s     	*&8&C&CDr    c                4    \         P                  ! R R7       R# r   r   r   r7   s   &r   r   ;TestLaunchpadLoginWith.test_application_name_identifies_app  s     	%%v>r    c                4    \         P                  ! R R7       R# r   r  r7   s   &r   r   8TestLaunchpadLoginWith.test_consumer_name_identifies_app  s     	%%F;r    c                t    \        \        R4      pV P                  \        \        P
                  RVR7       R# );Catch an attempt to specify inconsistent application_names.zapplication name1zapplication name2r  Nr   r   rt   ru   r   r   r
  s   & r   +test_inconsistent_application_name_rejectedBTestLaunchpadLoginWith.test_inconsistent_application_name_rejected  s9    --
 	))!'	 	 	
r    c                x    \        \        RRR7      pV P                  \        \        P
                  RVR7       R# )r  Nconsumer_name1r   consumer_name2r  r  r
  s   & r   (test_inconsistent_consumer_name_rejected?TestLaunchpadLoginWith.test_inconsistent_consumer_name_rejected  s;    -$.>
 	))!'	 	 	
r    c           	         \        \        RR.R7      pV P                  \        \        P
                  RRR.VR7       R# )z=Catch an attempt to specify inconsistent allow_access_levels.r   FOOr   allow_access_levelsNBAR)r   r#  r  r  r
  s   & r   .test_inconsistent_allow_access_levels_rejectedETestLaunchpadLoginWith.test_inconsistent_allow_access_levels_rejected  sD    -

 	))$!&!' 	 	
r    c                z    R  p\        VR7      pR pV P                  \        \        P                  RVVR7       R# )c                      R # r   r!   r!   r    r   	callback1RTestLaunchpadLoginWith.test_inconsistent_credential_save_failed.<locals>.callback1      r    )credential_save_failedc                      R # r   r!   r!   r    r   	callback2RTestLaunchpadLoginWith.test_inconsistent_credential_save_failed.<locals>.callback2  r+  r    app name)r   r,  N)r   rt   ru   r   r   )r   r)  r   r.  s   &   r   (test_inconsistent_credential_save_failed?TestLaunchpadLoginWith.test_inconsistent_credential_save_failed  sB    	 'iH	 	))"#, 	 	
r    c                F   \         P                  ! R R.R7      pV P                  VP                  P                  P
                  R 4       V P                  VP                  P                  P                  R4       V P                  VP                  P                  R.4       R# )r   r!  r"  N)	r   r   r   r   r   r   r   r  r#  r   r   s   & r   test_non_desktop_integration3TestLaunchpadLoginWith.test_non_desktop_integration#  s     '11$5'
	 	..77;;ZH..77HH$O**>>	
r    c                    \         P                  ! R R.R7      pV P                  VP                  P                  R.4       R# )r  r!  )r#  DESKTOP_INTEGRATIONN)r   r   r   r  r#  r4  s   & r   <test_desktop_integration_doesnt_happen_without_consumer_nameSTestLaunchpadLoginWith.test_desktop_integration_doesnt_happen_without_consumer_name0  s@    
 '11UG
	 	**>>"#	
r    c                x   \        4       p\        4       p\        P                  ! R V P                  \        VVR7      pV P                  VP                  P                  P                  \        P                  4       V P                  VP                  P                  P                  R 4       V P                  VP                  P                  R.4       \        \        \         P"                  P%                  V P                  RR4      VV\        P&                  R7      pV P                  VP(                  V4       R# )r0  )r   r~   timeout
proxy_infor8  r   r   )r~   r   r<  r=  r   N)objectr   r   r   r   r   r   access_tokenr   r   ACCESS_TOKEN_KEYr   r   r  r#  dictr   r   r   r   r   )r   r<  r=  r   expected_argumentss   &    r   *test_no_credentials_creates_new_credentialATestLaunchpadLoginWith.test_no_credentials_creates_new_credential=  s    (X
&11!]]%!
	 	!!..22(99	
 	!!**;;Z	
 	**>>"#	
 "%'',,t}}.?I!&66
 	113EFr    c                   \         P                  ! RV P                  \        R7      pV P	                  VP
                  P                  P                  R4       V P	                  VP
                  P                  P                  R4       \        P                  P                  V P                  RRR4      pV P                  \        P                  P                  V4      4       R# )z)Test the anonymous login helper function.zanonymous access)r   r~    r   r   N)r   login_anonymouslyr   r   r   r   r?  r   secretr   r   r   r   exists)r   r   r   s   &  r   test_anonymous_login+TestLaunchpadLoginWith.test_anonymous_login_  s    &88!]]%
	
 	..;;??D..;;BBBG 77<<MM,m=O
 	(89:r    c                   \         P                  ! \         P                  P                  V P                  R R4      4       \         P                  P                  V P                  R RR4      p\        RR\        RR4      R7      pVP                  V4       \        4       p\        4       pRp\        P                  ! RV P                  \        VVVR7      p\        \        VVV\         P                  P                  V P                  R R	4      R
7      pVP                  4        F)  w  rVP                  V,          p
V P                  W4       K+  	  R# )r   r   r0  zconsumer_secret:42zaccess_key:84zaccess_secret:168)consumer_secretr?  r   )r   r~   r<  r=  r   r   )r~   r<  r=  r   r   N)r   makedirsr   r   r   r   r   save_to_pathr>  r   r   r   rA  r   r   r   )r   credentials_file_pathr   r<  r=  r   r   rB  r   expectedactuals   &          r   -test_existing_credentials_arguments_passed_onDTestLaunchpadLoginWith.test_existing_credentials_arguments_passed_ono  s    	GGLL(9=I	
 !#MM,mZ!
 "0$_6IJ

 	  !67(X
&11!]]%!
	 "%!'',,t}}.?I
 0557MC--c2FV. 8r    c           	        \         P                  P                  R 4      pV P                  \         P                  R &   \        P
                  ! R\        R7      pVe   V\         P                  R &   M\         P                  R  VP                  R,          p\         P                  P                  \         P                  P                  VRR4      4      pV P                  V\         P                  P                  V P                  R4      4       V P                  \         P                  P                  \         P                  P                  VRR4      4      4       R# )HOMEr0  r   Nr   z..z.launchpadlibr   )r   r   r   r   r   r   r   r   r   abspathr   r   rB   rI  )r   old_homer   	cache_dirr   s   &    r   test_None_launchpadlib_dir1TestLaunchpadLoginWith.test_None_launchpadlib_dir  s     ::>>&)!]]

6&11\
	 !)BJJv

6",,W5	77??277<<	4+NObggll4==/J	
 	GGNN-/@'J	
r    c                   \         P                  ! R R4      pV P                  VP                  R,          R4       \         P                  ! R \        P
                  R,          4      pV P                  VP                  R,          \        P
                  R,          4       RpV P                  \        \         P                  R R4       R# )r0  r0   r~   z"https://api.staging.launchpad.net/r   N)r0  zhttps://)r   r   r   r   r   rM   rt   ru   r4  s   & r   test_short_service_name.TestLaunchpadLoginWith.test_short_service_name  s    &11*iH	$$^40	
 '11**95
	 	$$^4y)	
 -	*55z5	
r    c                6    \         P                  ! R ^R7       R# )r   )max_failed_attemptsNr  r7   s   &r   !test_max_failed_attempts_accepted8TestLaunchpadLoginWith.test_max_failed_attempts_accepted  s     	%%o1Mr    r   )r"   r#   r$   r%   r&   r8   r   r   r   r   r   r  r  r  r   r   r  r  r%  r1  r5  r9  rC  rJ  rS  rZ  r]  ra  r'   r(   __classcell__)r   r*   s   @@r   r   r   X  s     ++%:.L&LE2
:;E
?
<





&

 GD; $/L
2
2N Nr    r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )TestDeprecatedLoginMethodsi  z2Make sure the deprecated login methods still work.c                   \         P                  ! R R7      ;_uu_ 4       p\         P                  ! R4       \         P                  ! R\        4       \        P
                  ! RRR4       V P                  \        V4      ^4       V P                  V^ ,          P                  \        4       RRR4       R#   + '       g   i     R# ; i)Tr;   r=   r   r   tokenrH  N)
r>   r?   r@   PendingDeprecationWarningr   loginr   rA   rD   rE   r   rH   s   & r   test_login_is_deprecated3TestDeprecatedLoginMethods.test_login_is_deprecated  s    $$D11V!!(+!!(,EF$$Z(CS[!,VAY//1CD 2111s   BB66C	c                   \         P                  ! R R7      ;_uu_ 4       p\         P                  ! R4       \         P                  ! R\        4       \         P                  ! RR4       \
        P                  ! R4       V P                  \        V^ ,          P                  4      R4       V P                  V^ ,          P                  \        4       RRR4       R#   + '       g   i     R# ; i)Tr;   r=   r   z.*next release of cryptographyr   zThe Launchpad.get_token_and_login() method is deprecated. You should use Launchpad.login_anonymous() for anonymous access and Launchpad.login_with() for all other purposes.N)r>   r?   r@   ri  filterwarningsr   get_token_and_loginr   rG   messagerD   rE   rk  s   & r   &test_get_token_and_login_is_deprecatedATestDeprecatedLoginMethods.test_get_token_and_login_is_deprecated  s    $$D11V!!(+!!(,EF##; 22:>F1I%%&L VAY//1CD 2111s   B2CC-	r!   N)	r"   r#   r$   r%   r&   rl  rr  r'   r(   r)   s   @r   rf  rf    s     <EE Er    rf  c                      a  ] tR tRt o R tR t]P                  ! ]R]	! R 4      4      R 4       t
]P                  ! ]R]	! R 4      4      R 4       t]P                  ! ]R]	! R	 4      4      R
 4       tRtV tR# )!TestCredenitialSaveFailedCallbacki  c                t    \        4       \        P                  n        \        P
                  ! 4       V n        R # r   r   r   r   socketr   r   r   r7   s   &r   r8   'TestCredenitialSaveFailedCallback.setUp  %     )9(:% ((*r    c                x    \         \        P                  n         \        P                  ! V P
                  4       R # r   rx  r   r   r   r   r   r7   s   &r   r   *TestCredenitialSaveFailedCallback.tearDown       (.%dmm$r    _is_sudoc                     R # Fr!   r!   r    r   <lambda>*TestCredenitialSaveFailedCallback.<lambda>      ur    c           	     J  a . oV3R  lp\         P                  P                  V P                  R4      pRp\	        \        4       4      ;_uu_ 4        \        P                  ! RVVVR7       V P                  \        S4      ^4       RRR4       R#   + '       g   i     R# ; i)c                  *   < S P                  R 4       R # r   )append)callback_calleds   r   callbackPTestCredenitialSaveFailedCallback.test_credentials_save_failed.<locals>.callback  s     ""4(r    r   r   r   )r~   r   r,  N)
r   r   r   r   r   r   r   r   r   rA   )r   r  r   r~   r  s   &   @r   test_credentials_save_failed>TestCredenitialSaveFailedCallback.test_credentials_save_failed  s}    
 	)
 77<<~F0.*++)))!1'/	 S115 ,+++s   6BB"	c                     R # r  r!   r!   r    r   r  r    r  r    c           
        \         P                  P                  V P                  R 4      pRp\	        \        4       4      ;_uu_ 4        V P                  \        \        P                  RVVR7       RRR4       R#   + '       g   i     R# ; ir   r   r   r   N)
r   r   r   r   r   r   rt   RuntimeErrorr   r   r   r   r~   s   &  r   :test_default_credentials_save_failed_is_to_raise_exception\TestCredenitialSaveFailedCallback.test_default_credentials_save_failed_is_to_raise_exception  sg     77<<~F0.*++"--)!1   ,+++s   )A;;B	c                     R # )Tr!   r!   r    r   r  r     s    tr    c                    \         P                  P                  V P                  R 4      pRp\	        \        4       4      ;_uu_ 4        \        P                  ! RVVR7       RRR4       R#   + '       g   i     R# ; ir  )r   r   r   r   r   r   r   r   r  s   &  r   >test_credentials_save_fail_under_sudo_does_not_raise_exception`TestCredenitialSaveFailedCallback.test_credentials_save_fail_under_sudo_does_not_raise_exception   sV     77<<~F0.*++)))!1 ,+++s   A,,A=	rc  N)r"   r#   r$   r%   r8   r   r   r>  r   staticmethodr  r  r  r'   r(   r)   s   @r   ru  ru    s     +% \\$j,}2MN6 O6, \\$j,}2MN O \\$j,|2LM
 N
r    ru  c                      a  ] tR tRt o R tR t]P                  ! ]R]	! R 4      4      R 4       t
]P                  ! ]R]	! R 4      4      R 4       tR	tV tR
# )TestMultipleSitesi.  c                t    \        4       \        P                  n        \        P
                  ! 4       V n        R # r   rw  r7   s   &r   r8   TestMultipleSites.setUp3  rz  r    c                x    \         \        P                  n         \        P                  ! V P
                  4       R # r   r|  r7   s   &r   r   TestMultipleSites.tearDown:  r~  r    r  c                     R # r  r!   r!   r    r   r  TestMultipleSites.<lambda>>  r  r    c                ,   \         P                  P                  V P                  R 4      p\	        4       pRpRp\        V4      ;_uu_ 4        \        P                  ! VVVR7      pVP                  P                  P                  pRRR4       \        VP                  P                  4       4      ^ ,          ^,          pV P                  W74       V P                  XV4       V P                  WvR,           V,           4       R#   + '       g   i     L; i)r   r   zSuper App 3000r   N@)r   r   r   r   r   r   r   r   r   r   r   listdatarN   rF   r   )r   r   r   r~   r   r   r   application_keys   &       r   "test_components_of_application_key4TestMultipleSites.test_components_of_application_key>  s    77<<~F!#0+'""*55 )!1I
 &11::>>M # w||0023A6q9
 	l4m_5
 	#*=*LM' #"s   :DD	c                     R # r  r!   r!   r    r   r  r  Y  r  r    c                   \         P                  P                  V P                  R 4      p\	        4       pVP
                  '       d   Q R4       h\        V4      ;_uu_ 4        \        P                  ! RRVR7       \        P                  ! RRVR7       RRR4       \        VP
                  P                  4       4      ^8X  g   Q h\        VP
                  P                  4       4      ^ ,          ^,          p\        VP
                  P                  4       4      ^,          ^,          pV P                  W44       R#   + '       g   i     L; i)r   z$oops, a fresh keyring has data in itr  zhttp://alpha.example.com/r   zhttp://beta.example.com/N)r   r   r   r   r   r  r   r   r   rA   rN   r  r   )r   r   r   application_key_1application_key_2s   &    r   test_same_app_different_servers1TestMultipleSites.test_same_app_different_serversY  s    77<<~F!#<<<G!GG'"" ))"8!1
 ))"7!1 #  7<<$$&'1,,, !2!2!45a8; !2!2!45a8;-A) #"s   !3D;;E	rc  N)r"   r#   r$   r%   r8   r   r   r>  r   r  r  r  r'   r(   r)   s   @r   r  r  .  sc     
+% \\$j,}2MNN ON4 \\$j,}2MNB OBr    r  ),r&   
contextlibr   r   r   rx  r   r   unittestunittest.mockr   r>   lazr.restfulclient.resourcer   launchpadlib.credentialsr   r   r   r   launchpadlib.launchpadr   r	   launchpadlib.testing.helpersr
   r   r   r   r   r   r   r   r   TestCaser   r,   r|   r   r   r   r   r   rf  ru  r  r!   r    r   <module>r     s'  " % % 	        3
   , C  
 )Ih// IqGh'' qGh5
):): 5
p 
(*;*;  
FH,=,= <8;L;L 2-(## -rN[ rNjE E<@(9(9 @FEB)) EBr    