+
    5mj  c                     ^ RI Ht ^ RIt^ RIHu Ht ^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIt]
P                  P                  ^ ]! ]! ]4      P%                  4       P&                  ^,          4      4       ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IH t  R
RRRR//t!R R lt"R R lt# ! R R4      t$R R lt%R R lt&R# )    )annotationsN)PathAccount
AccountRef)pin_account_uuid)ClaudeHealthClientTokenIdentity)UsageReading)HealthStatusclaudeAiOauthaccessTokenliverefreshTokenzlive-refreshc                    V ^8  d   QhRRRR/# )   homer   returnr    )formats   "s/home/user/overdeck-private-tests/workstation-ai-broad/modules/systray/tests/test_claude_health_live_credentials.py__annotate__r      s      4 G     c                6    \        \        R R4      RV RRR4      # )claudeaviAvizavi@example.commaxacct_123r   )r   s   &r   _accountr       s(    8U# r   c               $    V ^8  d   QhRRRRRR/# )r   tmp_pathr   empty_account_credentialsboolr   ztuple[Path, Path]r   )r   s   "r   r   r   !   s"     # #T # #BS #r   c          	     `   V R ,          pVP                  4        V R,          pVP                  4        \        VR4       V'       d5   VR,          P                  \        P                  ! RRRRR//4      RR	7       VR,          P                  \        P                  ! \
        4      RR	7       W#3# )
CLAUDE_HOMEr   shared-uuid.credentials.jsonr   r    r   utf-8encoding)mkdirr   
write_textjsondumps_LIVE_CREDENTIALS)r"   r#   account_home	live_homes   &$  r   _homesr4   !   s    m+L6!IOO\=1 	+	+77JJ-^R)PQR 	8 	
 $$00

$% 1  ""r   c                  >    ] tR t^2tR	R R lltR R ltR R ltRtR# )
_LiveTokenIdentityc                    V ^8  d   QhRRRR/# )r   timeout_secsfloatr   Noner   )r   s   "r   r   _LiveTokenIdentity.__annotate__3   s      U d r   c                	    R # Nr   )selfr8   s   &&r   __init___LiveTokenIdentity.__init__3   s    r   c                    V ^8  d   QhRRRR/# )r   _credentials_pathr   r   strr   )r   s   "r   r   r;   6   s      $ 3 r   c                	    R # )r'   r   )r>   rB   s   &&r   account_uuid_for#_LiveTokenIdentity.account_uuid_for6   s    r   c                    V ^8  d   QhRRRR/# )r   _access_tokenrC   r   r
   r   )r   s   "r   r   r;   9   s     2 2C 2M 2r   c                	    \        R R4      # )r'   Nr	   )r>   rH   s   &&r   identify_token!_LiveTokenIdentity.identify_token9   s    ]D11r   r   N)g      $@)__name__
__module____qualname____firstlineno__r?   rE   rJ   __static_attributes__r   r   r   r6   r6   2   s    2 2r   r6   c               $    V ^8  d   QhRRRRRR/# r   monkeypatchzpytest.MonkeyPatchr"   r   r   r:   r   )r   s   "r   r   r   =   s&     / /#// 
/r   c                  a \        VR R7      w  r#. o ! V3R lR4      pV P                  RV4       V P                  R\        4       V P                  \        R\	        R 4      4       V P                  RV4       V P                  R	R
 4       \        4       P                  \        V4      4      pVR,          .pSV8H  qw'       g   \        P                  ! R(V3R)SV34      RR\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR;rvVP                  p\         P"                  qV
8H  q'       Eg   \        P                  ! R(V3R*Wz34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V
4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;rVP$                  p^
qV8H  q'       g   \        P                  ! R(V3R+W~34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p\        \        P                  ! V4      4      hR;p;rVP&                  p^*qV8H  q'       g   \        P                  ! R(V3R,W~34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p\        \        P                  ! V4      4      hR;p;rVP(                  pRqV8H  q'       g   \        P                  ! R(V3R-W~34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p\        \        P                  ! V4      4      hR;p;rVP*                  pRqV8H  q'       g   \        P                  ! R(V3R.W~34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p\        \        P                  ! V4      4      hR;p;r\,        P.                  pRpW>,          pVP0                  pRpV! VR7      pV! V4      pV\2        8H  pV'       Eg   \        P                  ! R(V3R/V\2        34      RR\        P                  ! 4       9   g!   \        P                  ! \,        4      '       d   \        P                  ! \,        4      MRR\        P                  ! V4      RR \        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR R\        P                  ! V4      R\        P                  ! V4      R!\        P                  ! V4      R"\        P                  ! V4      R#\        P                  ! V4      R$R%\        P                  ! 4       9   g!   \        P                  ! \2        4      '       d   \        P                  ! \2        4      MR%/	,          pR&R'V/,          p\        \        P                  ! V4      4      hR;p;p;p;p;p;p;ppR# )0Tr#   c                  F   < ] tR t^DtR	R V 3R llltR R ltR R ltRtR# )
Wtest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.LiveSessionNc               (    V ^8  d   QhRRRRRRRR/# 	r   credentials_pathr   r8   r9   allow_rotationr$   r   r:   r   )r   s   "r   r   dtest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.LiveSession.__annotate__E   s2     	. 	."	.  	. !		. 	.r   c                	*   < SP                  V4       R # r=   )append)r>   rZ   r8   r[   rotation_backup_pathsessionss   &&&&&r   r?   `test_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.LiveSession.__init__E   s     OO,-r   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r\   N        	U 	U| 	Ur   c                	8    \        V P                  4       R R7      # z
fake-token)payloadaccess_tokenr   	get_usager>   s   &r   get_usage_readingitest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.LiveSession.get_usage_readingN       (8|TTr   c                   V ^8  d   QhRR/# r   r   zdict[str, object]r   )r   s   "r   r   r\   Q   s     	 	0 	r   c                	    R R^
RR/RR^*RR//# )	five_hourutilization	resets_at   TA	seven_day   0FWAr   rk   s   &r   rj   atest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.LiveSession.get_usageQ   s(    mRoNmRoN r   r   g      @FNrL   rM   rN   rO   r?   rl   rj   rP   )r`   s   r   LiveSessionrW   D   s    	. 	.	U	 	r   r{   #claude_credentials.LIVE_CLAUDE_HOME(claude_health_client.ClaudeTokenIdentity_auth_statusc                "    \         P                  # r=   )r   OK)_path_creds_timeouts   &&&r   <lambda>Ttest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokens.<locals>.<lambda>\   s    \__r   'claude_health_client.ClaudeOAuthSessionclaude_health_client.time.timec                     R # g   @TAr   r   r   r   r   r   _       /r   r(   py0r`   py3assert %(py5)spy5Nsnapshotpy2py4r   py6zassert %(py8)spy8zassert %(py7)spy7ru   rw   r*   r+   r/   r3   py10py12py14py16r1   zassert %(py18)spy18==z%(py0)s == %(py3)s)zF%(py2)s
{%(py2)s = %(py0)s.status
} == %(py6)s
{%(py6)s = %(py4)s.OK
})z8%(py2)s
{%(py2)s = %(py0)s.primary_used_pct
} == %(py5)s)z:%(py2)s
{%(py2)s = %(py0)s.secondary_used_pct
} == %(py5)s)z8%(py2)s
{%(py2)s = %(py0)s.primary_reset_at
} == %(py5)s)z:%(py2)s
{%(py2)s = %(py0)s.secondary_reset_at
} == %(py5)s)z%(py14)s
{%(py14)s = %(py2)s
{%(py2)s = %(py0)s.loads
}(%(py12)s
{%(py12)s = %(py8)s
{%(py8)s = (%(py3)s / %(py5)s).read_text
}(encoding=%(py10)s)
})
} == %(py16)s)r4   setattrr6   r   staticmethodfetchr    
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationstatusr   r   primary_used_pctsecondary_used_pctprimary_reset_atsecondary_reset_atr/   loads	read_textr1   )rS   r"   r2   r3   r{   r   @py_assert2@py_assert1@py_format4@py_format6@py_assert5@py_assert3@py_format7@py_format9@py_assert4@py_format8@py_assert6@py_assert7@py_assert9@py_assert11@py_assert13@py_assert15@py_format17@py_format19r`   s   &&                      @r   Btest_fetch_reads_the_live_home_when_the_account_copy_has_no_tokensr   =   sW    %XNLH & =yIBDVWDE
 A;O8:QR!#))(<*@AH!$7788888888888888888888888888888888888??-loo-o-----?------8----8---?------l----l---o--------$$*******$******8****8***$***********&&,",",,,,,&,,,,,,8,,,,8,,,&,,,",,,,,,,,$$7777777$777777877778777$77777777777&&9/9/99999&999999899998999&999/99999999

 333>>HO>PPQQ	  Q                 3  >  HO  P  Q              r   c               $    V ^8  d   QhRRRRRR/# rR   r   )r   s   "r   r   r   o   s&     +) +)#+)+) 
+)r   c                  a
 \        VR R7      w  r#. o
R V
3R llp ! R R4      pV P                  RV4       V P                  R\        4       V P                  RV4       V P                  R	V4       V P                  R
R 4       \        4       P	                  \        V4      4       \        .pS
V8H  qw'       g   \        P                  ! RV3RS
V34      RR\        P                  ! 4       9   g   \        P                  ! S
4      '       d   \        P                  ! S
4      MRR\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR;rvR# )FrU   c               $    V ^8  d   QhRRRRRR/# )r   _objectkwargsr   z subprocess.CompletedProcess[str]r   )r   s   "r   r   Ftest_auth_status_probes_the_resolved_credentials.<locals>.__annotate__v   s"     

 

V 

v 

2R 

r   c                   < VR ,          p\        V\        4      q3'       Eg9   RRR\        P                  ! 4       9   g!   \        P
                  ! \         4      '       d   \        P                  ! \         4      MRRR \        P                  ! 4       9   g   \        P
                  ! V4      '       d   \        P                  ! V4      MR RR\        P                  ! 4       9   g!   \        P
                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR	p\        \        VR
,          4      4      pSP                  \        P                  ! VR,          P                  RR7      4      4       \        P                   ! . RO^ RRR7      # )envr)   z5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}r   
isinstancepy1r   dictr   NCLAUDE_CONFIG_DIRr(   r*   r+   z{"loggedIn": true}
)args
returncodestdoutstderr)r   authr   z--json)r   r   r   r   r   r   r   r   r   r   rC   r^   r/   r   r   
subprocessCompletedProcess)r   r   r   r   @py_format5
config_dirprobeds   *,    r   fake_runBtest_auth_status_probes_the_resolved_credentials.<locals>.fake_runv   s   Um#t$$$$$$$$$z$$$$z$$$$$$$#$$$$#$$$$$$$t$$$$t$$$$$$$$$$#c"5678
djj*/B"B!M!MW^!M!_`a**7)	
 	
r   c                  >    ] tR t^tR	R R lltR R ltR R ltRtR# )
Etest_auth_status_probes_the_resolved_credentials.<locals>.LiveSessionNc               (    V ^8  d   QhRRRRRRRR/# rY   r   )r   s   "r   r   Rtest_auth_status_probes_the_resolved_credentials.<locals>.LiveSession.__annotate__   s2     	5 	5"	5  	5 !		5 	5r   c                	    Wn         R # r=   rZ   )r>   rZ   r8   r[   r_   s   &&&&&r   r?   Ntest_auth_status_probes_the_resolved_credentials.<locals>.LiveSession.__init__   s
     %5!r   c                   V ^8  d   QhRR/# rc   r   )r   s   "r   r   r      rd   r   c                	8    \        V P                  4       R R7      # rf   ri   rk   s   &r   rl   Wtest_auth_status_probes_the_resolved_credentials.<locals>.LiveSession.get_usage_reading   rn   r   c                   V ^8  d   QhRR/# rp   r   )r   s   "r   r   r      s     	6 	60 	6r   c                	    R R^
//# )rr   rs   r   rk   s   &r   rj   Otest_auth_status_probes_the_resolved_credentials.<locals>.LiveSession.get_usage   s    -!455r   r   ry   rz   r   r   r   r{   r      s    	5	U	6 	6r   r{   r|   r}   z#claude_health_client.subprocess.runr   r   c                     R # r   r   r   r   r   r   Btest_auth_status_probes_the_resolved_credentials.<locals>.<lambda>   r   r   r   r   r   r   r   Nr   r   )r4   r   r6   r   r   r    r1   r   r   r   r   r   r   r   r   )rS   r"   r2   r3   r   r{   r   r   r   r   r   s   &&        @r   0test_auth_status_probes_the_resolved_credentialsr   o   s    %XOL&(F

 

6 6  =yIBDVW=xHA;O8:QRx56'((6((((((6(((((((6((((6((((((((((((r   )'
__future__r   builtinsr   _pytest.assertion.rewrite	assertionrewriter   r/   r   syspathlibr   pytestpathinsertrC   __file__resolveparentsaccount_registryr   r   claude_credentialsr   claude_health_clientr   claude_identityr
   claude_oauthr   health_clientr   r1   r    r4   r6   r   r   r   r   r   <module>r      s    "     
   3tH~--/77:; < 0 / 3 ) % &$}fnn&]^ #"2 2/d+)r   