Ë
    ÛJêj$  ã                   ó’   — d Z ddlZddlmc mZ ddlZddlm	Z	m
Z
mZmZ  G d„ d«      Z G d„ d«      Z G d„ d	«      Z G d
„ d«      Zy)zTests for AgentIdentity.é    N)ÚAgentIdentityÚ	AgentRoleÚPermissionScopeÚ
TrustLevelc                   óœ   — e Zd Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd	„Z
dd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)ÚTestAgentIdentityNc                 óÌ
  — t        dd¬«      }|j                  }d}||k(  }|s­t        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}}|j                  }d}||k(  }|s­t        j                  d|fd
||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}}|j                  }t        j                  }||k(  }|söt        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      dt	        j
                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      dœz  }dd|iz  }	t        t        j                  |	«      «      ‚d x}x}}|j                  }t        «       }||k(  }|söt        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      dt	        j
                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      dœz  }dd|iz  }	t        t        j                  |	«      «      ‚d x}x}}|j                   }d }||u }|s­t        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}}|j"                  }i }||k(  }|s­t        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}}y )Núagent-1Úcoder©Úagent_idÚrole©ú==)z0%(py2)s
{%(py2)s = %(py0)s.agent_id
} == %(py5)sÚidentity©Úpy0Úpy2Úpy5úassert %(py7)sÚpy7©z,%(py2)s
{%(py2)s = %(py0)s.role
} == %(py5)s)zQ%(py2)s
{%(py2)s = %(py0)s.trust_level
} == %(py6)s
{%(py6)s = %(py4)s.VERIFIED
}r   ©r   r   Úpy4Úpy6úassert %(py8)sÚpy8)zE%(py2)s
{%(py2)s = %(py0)s.scopes
} == %(py6)s
{%(py6)s = %(py4)s()
}Úset©Úis)z-%(py2)s
{%(py2)s = %(py0)s.owner
} is %(py5)s)z0%(py2)s
{%(py2)s = %(py0)s.metadata
} == %(py5)s)r   r   Ú
@pytest_arÚ_call_reprcompareÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚ	_safereprÚAssertionErrorÚ_format_explanationr   Útrust_levelr   ÚVERIFIEDÚscopesr   ÚownerÚmetadata)
Úselfr   Ú@py_assert1Ú@py_assert4Ú@py_assert3Ú@py_format6Ú@py_format8Ú@py_assert5Ú@py_format7Ú@py_format9s
             ú>/home/oem/CyberBrain26-unified/tests/test_security_identity.pyÚtest_create_minimal_identityz.TestAgentIdentity.test_create_minimal_identity   sô  € Ü ¨)¸'ÔBˆØ× Ñ Ð- IÐ-Ð  IÑ-×-×-Õ-Ð  I×-×-×-×-×-Ñ-ˆx×-×-Ó-ˆx×-×-Ô-Ð ×-×-Ò- I×-×-×-×-×-×-Ó-Ø�}‰}Ð' Ð'ˆ} Ñ'×'×'Õ'ˆ} ×'×'×'×'×'Ñ'ˆx×'×'Ó'ˆx×'×'Ô'ˆ}×'×'Ò' ×'×'×'×'×'×'Ó'Ø×#Ñ#Ð:¤z×':Ñ':Ð:Ð#Ð':Ñ:×:×:Õ:Ð#Ð':×:×:×:×:×:Ñ:ˆx×:×:Ó:ˆx×:×:Ô:Ð#×:×:×:×:×:Ð:¤z×:×:Ó:¤z×:×:Ô:Ð':×:×:×:×:×:×:Ó:Ø�‰Ð'¤#£%Ð'ˆ %Ñ'×'×'Õ'ˆ %×'×'×'×'×'Ñ'ˆx×'×'Ó'ˆx×'×'Ô'ˆ×'×'×'×'×'Ð'¤#×'×'Ó'¤#×'×'Ô' %×'×'×'×'×'×'Ó'Ø�~‰~Ð% Ð%ˆ~ Ð%×%×%Õ%ˆ~ ×%×%×%×%×%Ñ%ˆx×%×%Ó%ˆx×%×%Ô%ˆ~×%×%Ò% ×%×%×%×%×%×%Ó%Ø× Ñ Ð& BÐ&Ð  BÑ&×&×&Õ&Ð  B×&×&×&×&×&Ñ&ˆx×&×&Ó&ˆx×&×&Ô&Ð ×&×&Ò& B×&×&×&×&×&×&Ô&ó    c           
      óf  — t        ddt        j                  t        j                  t        j
                  hddddœ¬«      }|j                  }t        j                  }||k(  }|söt        j                  d|fd	||f«      d
t        j                  «       v st        j                  |«      rt        j                  |«      nd
t        j                  |«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      ndt        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}}|j                  }d}||k(  }|s­t        j                  d|fd||f«      d
t        j                  «       v st        j                  |«      rt        j                  |«      nd
t        j                  |«      t        j                  |«      dœz  }dd|iz  }	t        t        j                  |	«      «      ‚d x}x}}|j                   d   }
d}|
|k(  }|slt        j                  d|fd|
|f«      t        j                  |
«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}
x}}y )Nzagent-2Úplannerzuser-1Úlocalz1.0)ÚproviderÚversion)r   r   r)   r+   r,   r-   r   )zP%(py2)s
{%(py2)s = %(py0)s.trust_level
} == %(py6)s
{%(py6)s = %(py4)s.TRUSTED
}r   r   r   r   r   )z-%(py2)s
{%(py2)s = %(py0)s.owner
} == %(py5)sr   r   r   r=   ©z%(py1)s == %(py4)s©Úpy1r   úassert %(py6)sr   )r   r   ÚTRUSTEDr   Ú	READ_FILEÚ
WRITE_FILEr)   r!   r"   r#   r$   r%   r&   r'   r(   r,   r-   )r.   r   r/   r4   r1   r5   r6   r0   r2   r3   Ú@py_assert0Ú@py_assert2Ú@py_format5s                r7   Útest_create_full_identityz+TestAgentIdentity.test_create_full_identity   s›  € Ü ØØÜ"×*Ñ*Ü#×-Ñ-¬×/IÑ/IÐJØØ")°eÑ<ô
ˆð ×#Ñ#Ð9¤z×'9Ñ'9Ð9Ð#Ð'9Ñ9×9×9Õ9Ð#Ð'9×9×9×9×9×9Ñ9ˆx×9×9Ó9ˆx×9×9Ô9Ð#×9×9×9×9×9Ð9¤z×9×9Ó9¤z×9×9Ô9Ð'9×9×9×9×9×9×9Ó9Ø�~‰~Ð) Ð)ˆ~ Ñ)×)×)Õ)ˆ~ ×)×)×)×)×)Ñ)ˆx×)×)Ó)ˆx×)×)Ô)ˆ~×)×)Ò) ×)×)×)×)×)×)Ó)Ø× Ñ  Ñ,Ð7°Ð7Ð,°Ñ7×7×7Õ7Ð,°×7×7Ó7Ð,×7×7Ò7°×7×7×7×7×7×7Ô7r9   c                 ó~   — t        j                  t        d¬«      5  t        dd¬«       d d d «       y # 1 sw Y   y xY w)Nzagent_id must not be empty©ÚmatchÚ r   r   ©ÚpytestÚraisesÚ
ValueErrorr   ©r.   s    r7   Útest_empty_agent_id_raisesz,TestAgentIdentity.test_empty_agent_id_raises$   s0   € Ü�]‰]œ:Ð-IÔJñ 	5Ü 2¨GÕ4÷	5÷ 	5ñ 	5úó   œ3³<c                 ó~   — t        j                  t        d¬«      5  t        dd¬«       d d d «       y # 1 sw Y   y xY w)Nzrole must not be emptyrK   r
   rM   r   rN   rR   s    r7   Útest_empty_role_raisesz(TestAgentIdentity.test_empty_role_raises(   s0   € Ü�]‰]œ:Ð-EÔFñ 	7Ü 9°2Õ6÷	7÷ 	7ñ 	7úrT   c                 ó8  — t        ddt        j                  h¬«      }|j                  }d} ||«      }d}||u }|sÕt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      t	        j                  |«      d	œz  }d
d|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}y )NÚa1r   ©r   r   r+   Ú	read_fileTr   ©zO%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.has_scope
}(%(py4)s)
} is %(py9)sr   ©r   r   r   r   Úpy9úassert %(py11)sÚpy11)r   r   rD   Ú	has_scoper!   r"   r#   r$   r%   r&   r'   r(   ©	r.   r   r/   r1   r4   Ú@py_assert8Ú@py_assert7Ú@py_format10Ú@py_format12s	            r7   Útest_has_scope_truez%TestAgentIdentity.test_has_scope_true,   sº   € Ü Ø ´×1JÑ1JÐ0Kô
ˆð ×!Ñ!Ð6 +Ð6Ñ! +Ó.Ð6°$Ð6Ð.°$Ð6×6×6Õ6Ð.°$×6×6×6×6×6Ñ6ˆx×6×6Ó6ˆx×6×6Ô6Ð!×6×6Ò6 +×6×6Ò6Ð.×6×6Ò6°$×6×6×6×6×6×6×6Ð6r9   c                 ó  — t        dd¬«      }|j                  }d} ||«      }d}||u }|sÕt        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      t        j                  |«      t        j                  |«      d	œz  }d
d|iz  }t        t        j                  |«      «      ‚d x}x}x}x}}y )NrX   r   r   rZ   Fr   r[   r   r\   r^   r_   )
r   r`   r!   r"   r#   r$   r%   r&   r'   r(   ra   s	            r7   Útest_has_scope_falsez&TestAgentIdentity.test_has_scope_false2   sª   € Ü ¨$°WÔ=ˆØ×!Ñ!Ð7 +Ð7Ñ! +Ó.Ð7°%Ð7Ð.°%Ð7×7×7Õ7Ð.°%×7×7×7×7×7Ñ7ˆx×7×7Ó7ˆx×7×7Ô7Ð!×7×7Ò7 +×7×7Ò7Ð.×7×7Ò7°%×7×7×7×7×7×7×7Ð7r9   c                 ó:  — t        ddt        j                  h¬«      }|j                  }ddh} ||«      }d}||u }|sÕt	        j
                  d|fd||f«      d	t        j                  «       v st	        j                  |«      rt	        j                  |«      nd	t	        j                  |«      t	        j                  |«      t	        j                  |«      t	        j                  |«      d
œz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}|j                  }ddh} ||«      }d}||u }|sÕt	        j
                  d|fd||f«      d	t        j                  «       v st	        j                  |«      rt	        j                  |«      nd	t	        j                  |«      t	        j                  |«      t	        j                  |«      t	        j                  |«      d
œz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}y )NrX   r   rY   rZ   Ú
write_fileTr   )zS%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.has_any_scope
}(%(py4)s)
} is %(py9)sr   r\   r^   r_   Údelete_fileF)r   r   rD   Úhas_any_scoper!   r"   r#   r$   r%   r&   r'   r(   ra   s	            r7   Ú test_has_any_scope_partial_matchz2TestAgentIdentity.test_has_any_scope_partial_match6   sa  € Ü Ø ´×1JÑ1JÐ0Kô
ˆð ×%Ñ%ÐJ {°LÐ&AÐJÑ%Ð&AÓBÐJÀdÐJÐBÀdÐJ×J×JÕJÐBÀd×J×J×J×J×JÑJˆx×J×JÓJˆx×J×JÔJÐ%×J×JÒJÐ&A×J×JÒJÐB×J×JÒJÀd×J×J×J×J×J×J×JØ×%Ñ%ÐM |°]Ð&CÐMÑ%Ð&CÓDÐMÈÐMÐDÈÐM×M×MÕMÐDÈ×M×M×M×M×MÑMˆx×M×MÓMˆx×M×MÔMÐ%×M×MÒMÐ&C×M×MÒMÐD×M×MÒMÈ×M×M×M×M×M×M×MÐMr9   c                 óÎ  — t        ddt        j                  h¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y )NrX   r   rY   Tr   )zL%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.can_read_file
}()
} is %(py7)sr   ©r   r   r   r   úassert %(py9)sr]   F)zM%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.can_write_file
}()
} is %(py7)s)r   r   rD   Úcan_read_filer!   r"   r#   r$   r%   r&   r'   r(   Úcan_write_file©r.   r   r/   r1   Ú@py_assert6r4   r3   rd   s           r7   Útest_can_read_filez$TestAgentIdentity.test_can_read_file=   s,  € Ü Ø ´×1JÑ1JÐ0Kô
ˆð ×%Ñ%Ð/Ñ%Ó'Ð/¨4Ð/Ð'¨4Ð/×/×/Õ/Ð'¨4×/×/×/×/×/Ñ/ˆx×/×/Ó/ˆx×/×/Ô/Ð%×/×/Ò/Ð'×/×/Ò/¨4×/×/×/×/×/×/Õ/Ø×&Ñ&Ð1Ñ&Ó(Ð1¨EÐ1Ð(¨EÐ1×1×1Õ1Ð(¨E×1×1×1×1×1Ñ1ˆx×1×1Ó1ˆx×1×1Ô1Ð&×1×1Ò1Ð(×1×1Ò1¨E×1×1×1×1×1×1Ö1r9   c                 ó$  — t        ddt        j                  t        j                  h¬«      }|j                  } |«       }d}||u }|sÁt        j                  d|fd||f«      dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }d	d
|iz  }t        t        j                  |«      «      ‚d x}x}x}}y )NrX   r   rY   Tr   )zP%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.can_execute_shell
}()
} is %(py7)sr   ro   rp   r]   )r   r   ÚSHELLÚPYTHONÚcan_execute_shellr!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_can_execute_shellz(TestAgentIdentity.test_can_execute_shellD   s¯   € Ü ØØÜ#×)Ñ)¬?×+AÑ+AÐBô
ˆð
 ×)Ñ)Ð3Ñ)Ó+Ð3¨tÐ3Ð+¨tÐ3×3×3Õ3Ð+¨t×3×3×3×3×3Ñ3ˆx×3×3Ó3ˆx×3×3Ô3Ð)×3×3Ò3Ð+×3×3Ò3¨t×3×3×3×3×3×3Ö3r9   c                 ó  — t        ddt        j                  h¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y )NrX   ÚresearchrY   Tr   )zQ%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.can_access_network
}()
} is %(py7)sr   ro   rp   r]   )r   r   ÚNETWORKÚcan_access_networkr!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_can_access_networkz)TestAgentIdentity.test_can_access_networkL   ó§   € Ü ØØÜ#×+Ñ+Ð,ô
ˆð
 ×*Ñ*Ð4Ñ*Ó,Ð4°Ð4Ð,°Ð4×4×4Õ4Ð,°×4×4×4×4×4Ñ4ˆx×4×4Ó4ˆx×4×4Ô4Ð*×4×4Ò4Ð,×4×4Ò4°×4×4×4×4×4×4Ö4r9   c                 ó  — t        ddt        j                  h¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y )NrX   ÚsecurityrY   Tr   )zQ%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.can_access_secrets
}()
} is %(py7)sr   ro   rp   r]   )r   r   ÚSECRETSÚcan_access_secretsr!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_can_access_secretsz)TestAgentIdentity.test_can_access_secretsT   r€   r9   c                 ó  — t        ddt        j                  ¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y ©NrX   r   ©r   r   r)   Tr   ©zI%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.is_trusted
}()
} is %(py7)sr   ro   rp   r]   )r   r   ÚOFFICIALÚ
is_trustedr!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_is_trusted_officialz*TestAgentIdentity.test_is_trusted_official\   s¢   € Ü Ø ´Z×5HÑ5Hô
ˆð ×"Ñ"Ð,Ñ"Ó$Ð,¨Ð,Ð$¨Ð,×,×,Õ,Ð$¨×,×,×,×,×,Ñ,ˆx×,×,Ó,ˆx×,×,Ô,Ð"×,×,Ò,Ð$×,×,Ò,¨×,×,×,×,×,×,Ö,r9   c                 ó  — t        ddt        j                  ¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y r‡   )r   r   rC   r‹   r!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_is_trusted_trustedz)TestAgentIdentity.test_is_trusted_trustedb   s¢   € Ü Ø ´Z×5GÑ5Gô
ˆð ×"Ñ"Ð,Ñ"Ó$Ð,¨Ð,Ð$¨Ð,×,×,Õ,Ð$¨×,×,×,×,×,Ñ,ˆx×,×,Ó,ˆx×,×,Ô,Ð"×,×,Ò,Ð$×,×,Ò,¨×,×,×,×,×,×,Ö,r9   c                 ó  — t        ddt        j                  ¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y ©NrX   r   rˆ   Fr   r‰   r   ro   rp   r]   )r   r   r*   r‹   r!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_is_trusted_verifiedz*TestAgentIdentity.test_is_trusted_verifiedh   s¢   € Ü Ø ´Z×5HÑ5Hô
ˆð ×"Ñ"Ð-Ñ"Ó$Ð-¨Ð-Ð$¨Ð-×-×-Õ-Ð$¨×-×-×-×-×-Ñ-ˆx×-×-Ó-ˆx×-×-Ô-Ð"×-×-Ò-Ð$×-×-Ò-¨×-×-×-×-×-×-Ö-r9   c                 ó  — t        ddt        j                  ¬«      }|j                  } |«       }d}||u }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |«      t	        j                  |«      dœz  }d	d
|iz  }t        t	        j                  |«      «      ‚d x}x}x}}y r�   )r   r   Ú	UNTRUSTEDr‹   r!   r"   r#   r$   r%   r&   r'   r(   rs   s           r7   Útest_is_trusted_untrustedz+TestAgentIdentity.test_is_trusted_untrustedn   s¢   € Ü Ø ´Z×5IÑ5Iô
ˆð ×"Ñ"Ð-Ñ"Ó$Ð-¨Ð-Ð$¨Ð-×-×-Õ-Ð$¨×-×-×-×-×-Ñ-ˆx×-×-Ó-ˆx×-×-Ô-Ð"×-×-Ò-Ð$×-×-Ò-¨×-×-×-×-×-×-Ö-r9   c                 ó®  — t        dd¬«      }|j                  }d}||k(  }|s­t        j                  d|fd||f«      dt	        j
                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      dœz  }dd	|iz  }t        t        j                  |«      «      ‚d x}x}}y )
NrX   Úcustom_roler   r   r   r   r   r   r   )
r   r   r!   r"   r#   r$   r%   r&   r'   r(   )r.   r   r/   r0   r1   r2   r3   s          r7   Útest_custom_role_stringz)TestAgentIdentity.test_custom_role_stringt   s{   € Ü ¨$°]ÔCˆØ�}‰}Ð- Ð-ˆ} Ñ-×-×-Õ-ˆ} ×-×-×-×-×-Ñ-ˆx×-×-Ó-ˆx×-×-Ô-ˆ}×-×-Ò- ×-×-×-×-×-×-Ô-r9   c                 óP  — t        dd¬«      }d|j                  d<   |j                  d   }d}||k(  }|slt        j                  d|fd||f«      t        j                  |«      t        j                  |«      dœz  }d	d
|iz  }t        t        j                  |«      «      ‚d x}x}}y )NrX   r   r   ÚtestÚnoter   r?   r@   rB   r   )r   r-   r!   r"   r&   r'   r(   )r.   r   rF   r1   rG   rH   r5   s          r7   Útest_metadata_can_be_mutatedz.TestAgentIdentity.test_metadata_can_be_mutatedx   sv   € Ü ¨$°WÔ=ˆØ$*ˆ×Ñ˜&Ñ!Ø× Ñ  Ñ(Ð2¨FÐ2Ð(¨FÑ2×2×2Õ2Ð(¨F×2×2Ó2Ð(×2×2Ò2¨F×2×2×2×2×2×2Ô2r9   c                 ój  — t        dd¬«      }|j                  j                  t        j                  «       |j
                  }d} ||«      }d}||u }|sÕt        j                  d|fd||f«      dt        j                  «       v st        j                  |«      rt        j                  |«      ndt        j                  |«      t        j                  |«      t        j                  |«      t        j                  |«      d	œz  }d
d|iz  }t        t        j                  |«      «      ‚d x}x}x}x}}y )NrX   r   r   ÚnetworkTr   r[   r   r\   r^   r_   )r   r+   Úaddr   r}   r`   r!   r"   r#   r$   r%   r&   r'   r(   ra   s	            r7   Útest_scopes_can_be_mutatedz,TestAgentIdentity.test_scopes_can_be_mutated}   sÂ   € Ü ¨$°WÔ=ˆØ�‰×ÑœO×3Ñ3Ô4Ø×!Ñ!Ð4 )Ð4Ñ! )Ó,Ð4°Ð4Ð,°Ð4×4×4Õ4Ð,°×4×4×4×4×4Ñ4ˆx×4×4Ó4ˆx×4×4Ô4Ð!×4×4Ò4 )×4×4Ò4Ð,×4×4Ò4°×4×4×4×4×4×4×4Ð4r9   ©ÚreturnN)Ú__name__Ú
__module__Ú__qualname__r8   rI   rS   rV   rf   rh   rm   ru   rz   r   r…   rŒ   rŽ   r‘   r”   r—   r›   rŸ   © r9   r7   r   r      s]   „ ó'ó8ó5ó7ó7ó8óNó2ó4ó5ó5ó-ó-ó.ó.ó.ó3ô
5r9   r   c                   ó   — e Zd Zdd„Zy)ÚTestTrustLevelNc                 ó´  — t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd	||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d
}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}y )NÚ	untrustedr   )zL%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.UNTRUSTED
}.value
} == %(py7)sr   ro   rp   r]   Úverified)zK%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.VERIFIED
}.value
} == %(py7)sÚtrusted)zJ%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.TRUSTED
}.value
} == %(py7)sÚofficial)zK%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.OFFICIAL
}.value
} == %(py7)s)r   r“   Úvaluer!   r"   r#   r$   r%   r&   r'   r(   r*   rC   rŠ   ©r.   r/   r1   rt   r4   r3   rd   s          r7   Útest_valueszTestTrustLevel.test_values„   s*  € Ü×#Ñ#Ð8Ð#×)Ñ)Ð8¨[Ð8Ð)¨[Ñ8×8×8Õ8Ð)¨[×8×8×8×8×8Ñ8Œz×8×8Ó8Œz×8×8Ô8Ð#×8×8Ò8Ð)×8×8Ò8¨[×8×8×8×8×8×8Õ8Ü×"Ñ"Ð6Ð"×(Ñ(Ð6¨JÐ6Ð(¨JÑ6×6×6Õ6Ð(¨J×6×6×6×6×6Ñ6Œz×6×6Ó6Œz×6×6Ô6Ð"×6×6Ò6Ð(×6×6Ò6¨J×6×6×6×6×6×6Õ6Ü×!Ñ!Ð4Ð!×'Ñ'Ð4¨9Ð4Ð'¨9Ñ4×4×4Õ4Ð'¨9×4×4×4×4×4Ñ4Œz×4×4Ó4Œz×4×4Ô4Ð!×4×4Ò4Ð'×4×4Ò4¨9×4×4×4×4×4×4Õ4Ü×"Ñ"Ð6Ð"×(Ñ(Ð6¨JÐ6Ð(¨JÑ6×6×6Õ6Ð(¨J×6×6×6×6×6Ñ6Œz×6×6Ó6Œz×6×6Ô6Ð"×6×6Ò6Ð(×6×6Ò6¨J×6×6×6×6×6×6Ö6r9   r    ©r¢   r£   r¤   r¯   r¥   r9   r7   r§   r§   ƒ   s   „ ô7r9   r§   c                   ó   — e Zd Zdd„Zy)ÚTestPermissionScopeNc                 ó´  — t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd	||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d
}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}y )NrZ   r   )zL%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.READ_FILE
}.value
} == %(py7)sr   ro   rp   r]   rj   )zM%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.WRITE_FILE
}.value
} == %(py7)sÚshell)zH%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.SHELL
}.value
} == %(py7)sÚsecrets)zJ%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.SECRETS
}.value
} == %(py7)s)r   rD   r­   r!   r"   r#   r$   r%   r&   r'   r(   rE   rw   rƒ   r®   s          r7   r¯   zTestPermissionScope.test_valuesŒ   s*  € Ü×(Ñ(Ð=Ð(×.Ñ.Ð=°+Ð=Ð.°+Ñ=×=×=Õ=Ð.°+×=×=×=×=×=Ñ=Œ×=×=Ó=Œ×=×=Ô=Ð(×=×=Ò=Ð.×=×=Ò=°+×=×=×=×=×=×=Õ=Ü×)Ñ)Ð?Ð)×/Ñ/Ð?°<Ð?Ð/°<Ñ?×?×?Õ?Ð/°<×?×?×?×?×?Ñ?Œ×?×?Ó?Œ×?×?Ô?Ð)×?×?Ò?Ð/×?×?Ò?°<×?×?×?×?×?×?Õ?Ü×$Ñ$Ð5Ð$×*Ñ*Ð5¨gÐ5Ð*¨gÑ5×5×5Õ5Ð*¨g×5×5×5×5×5Ñ5Œ×5×5Ó5Œ×5×5Ô5Ð$×5×5Ò5Ð*×5×5Ò5¨g×5×5×5×5×5×5Õ5Ü×&Ñ&Ð9Ð&×,Ñ,Ð9°	Ð9Ð,°	Ñ9×9×9Õ9Ð,°	×9×9×9×9×9Ñ9Œ×9×9Ó9Œ×9×9Ô9Ð&×9×9Ò9Ð,×9×9Ò9°	×9×9×9×9×9×9Ö9r9   r    r°   r¥   r9   r7   r²   r²   ‹   s   „ ô:r9   r²   c                   ó   — e Zd Zdd„Zy)ÚTestAgentRoleNc                 óÈ  — t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d}||k(  }|sÉt        j                  d|fd	||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}t         j                  }|j                  }d
}||k(  }|sÉt        j                  d|fd||f«      dt        j                  «       v st        j                  t         «      rt        j                  t         «      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}x}x}}y )Nr;   r   )zJ%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.PLANNER
}.value
} == %(py7)sr   ro   rp   r]   r   )zH%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.CODER
}.value
} == %(py7)sr‚   )zK%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.SECURITY
}.value
} == %(py7)s)r   ÚPLANNERr­   r!   r"   r#   r$   r%   r&   r'   r(   ÚCODERÚSECURITYr®   s          r7   r¯   zTestAgentRole.test_values”   sœ  € Ü× Ñ Ð3Ð ×&Ñ&Ð3¨)Ð3Ð&¨)Ñ3×3×3Õ3Ð&¨)×3×3×3×3×3Ñ3Œy×3×3Ó3Œy×3×3Ô3Ð ×3×3Ò3Ð&×3×3Ò3¨)×3×3×3×3×3×3Õ3Ü�‰Ð/ˆ×$Ñ$Ð/¨Ð/Ð$¨Ñ/×/×/Õ/Ð$¨×/×/×/×/×/Ñ/Œy×/×/Ó/Œy×/×/Ô/ˆ×/×/Ò/Ð$×/×/Ò/¨×/×/×/×/×/×/Õ/Ü×!Ñ!Ð5Ð!×'Ñ'Ð5¨:Ð5Ð'¨:Ñ5×5×5Õ5Ð'¨:×5×5×5×5×5Ñ5Œy×5×5Ó5Œy×5×5Ô5Ð!×5×5Ò5Ð'×5×5Ò5¨:×5×5×5×5×5×5Ö5r9   r    r°   r¥   r9   r7   r·   r·   “   s   „ ô6r9   r·   )Ú__doc__Úbuiltinsr#   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter!   rO   Ú$cyberbrain26.security_plane.identityr   r   r   r   r   r§   r²   r·   r¥   r9   r7   ú<module>rÂ      sD   ðÙ ç  „ ƒ÷ó ÷s5ñ s5÷l7ñ 7÷:ñ :÷6ò 6r9   