§
     ’js  ã                   ó    — d dl Zd dlmc mZ d dlZd dlmZ d dl	m
Z
 d dlmZ  G d„ dej        ¦  «        Zedk    r ej        ¦   «          dS dS )é    N)Ú
TestClient)Úget_current_user)Ú
create_appc                   ó>   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚTestRbacProtectionc                 ó^   — t          ¦   «         | _        t          | j        ¦  «        | _        d S ©N)r   Úappr   Úclient©Úselfs    ú0C:\Projects\DSCons\tests\test_rbac_protection.pyÚsetUpzTestRbacProtection.setUp
   s"   € Ý‘<”<ˆŒÝ  ¤Ñ*Ô*ˆŒˆˆó    c                 ó   — i | j         _        d S r	   )r
   Údependency_overridesr   s    r   ÚtearDownzTestRbacProtection.tearDown   s   € Ø(*ˆŒÔ%Ð%Ð%r   c                 óp   — | j                              d¦  «        }|                      |j        d¦  «         d S )Nú/v1/erp/equipmenti‘  )r   ÚgetÚassertEqualÚstatus_code©r   Úresponses     r   Útest_unauthorized_endpointsz.TestRbacProtection.test_unauthorized_endpoints   s5   € à”;—?’?Ð#6Ñ7Ô7ˆØ×Ò˜Ô-¨sÑ3Ô3Ð3Ð3Ð3r   c                 óš   — d„ | j         j        t          <   | j                             d¦  «        }|                      |j        d¦  «         d S )Nc                  ó   — ddddœS )Núuser-admin-idzdinhsonconstruction@gmail.comÚ
superadmin©ÚidÚemailÚrole© r$   r   r   ú<lambda>zCTestRbacProtection.test_role_authorized_endpoints.<locals>.<lambda>   s   € Ø!Ø4Ø ðC
ð C
€ r   r   éÈ   ©r
   r   r   r   r   r   r   r   s     r   Útest_role_authorized_endpointsz1TestRbacProtection.test_role_authorized_endpoints   sN   € ð;
ð ;
ˆŒÔ%Õ&6Ñ7ð ”;—?’?Ð#6Ñ7Ô7ˆØ×Ò˜Ô-¨sÑ3Ô3Ð3Ð3Ð3r   c                 ó°   — d„ | j         j        t          <   | j                             dddddddd	d
dœ¬¦  «        }|                      |j        d¦  «         d S )Nc                  ó   — ddddœS ©Nzuser-viewer-idzviewer@dscons.vnÚviewerr    r$   r$   r   r   r%   zBTestRbacProtection.test_role_forbidden_endpoints.<locals>.<lambda>#   ó   € Ø"Ø'ØðC
ð C
€ r   r   z$00000000-0000-0000-0000-000000000001zEQ-TEST-999u   MÃ¡y xÃºc Kobelco TestÚ	excavatorÚownedg    €„Ag      )@Ú	available)Ú
company_idÚequipment_codeÚequipment_nameÚequipment_typeÚownership_typeÚhourly_rate_standardÚfuel_norm_per_hourÚstatus)Újsoné“  )r
   r   r   r   Úpostr   r   r   s     r   Útest_role_forbidden_endpointsz0TestRbacProtection.test_role_forbidden_endpoints!   s}   € ð;
ð ;
ˆŒÔ%Õ&6Ñ7ð ”;×#Ò#ØàDØ"/Ø":Ø"-Ø")Ø(0Ø&*Ø%ð	ð 	ð $ñ 
ô 
ˆð 	×Ò˜Ô-¨sÑ3Ô3Ð3Ð3Ð3r   c                 óš   — d„ | j         j        t          <   | j                             d¦  «        }|                      |j        d¦  «         d S )Nc                  ó   — ddddœS r+   r$   r$   r   r   r%   zRTestRbacProtection.test_viewer_forbidden_from_financial_war_room.<locals>.<lambda>;   r-   r   ú/v1/war-room/summaryr:   r'   r   s     r   Ú-test_viewer_forbidden_from_financial_war_roomz@TestRbacProtection.test_viewer_forbidden_from_financial_war_room9   óN   € ð;
ð ;
ˆŒÔ%Õ&6Ñ7ð
 ”;—?’?Ð#9Ñ:Ô:ˆØ×Ò˜Ô-¨sÑ3Ô3Ð3Ð3Ð3r   c                 óš   — d„ | j         j        t          <   | j                             d¦  «        }|                      |j        d¦  «         d S )Nc                  ó   — ddddœS r+   r$   r$   r   r   r%   zTTestRbacProtection.test_viewer_forbidden_from_invoice_sync_configs.<locals>.<lambda>E   r-   r   z/v1/erp/invoices/sync/configsr:   r'   r   s     r   Ú/test_viewer_forbidden_from_invoice_sync_configszBTestRbacProtection.test_viewer_forbidden_from_invoice_sync_configsC   sN   € ð;
ð ;
ˆŒÔ%Õ&6Ñ7ð
 ”;—?’?Ð#BÑCÔCˆØ×Ò˜Ô-¨sÑ3Ô3Ð3Ð3Ð3r   c                 óš   — d„ | j         j        t          <   | j                             d¦  «        }|                      |j        d¦  «         d S )Nc                  ó   — ddddœS )Nr   zadmin@dscons.vnr   r    r$   r$   r   r   r%   zOTestRbacProtection.test_superadmin_allowed_financial_war_room.<locals>.<lambda>O   s   € Ø!Ø&Ø ðC
ð C
€ r   r?   r&   r'   r   s     r   Ú*test_superadmin_allowed_financial_war_roomz=TestRbacProtection.test_superadmin_allowed_financial_war_roomM   rA   r   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r(   r<   r@   rD   rG   r$   r   r   r   r   	   sŒ   € € € € € ð+ð +ð +ð+ð +ð +ð4ð 4ð 4ð
	4ð 	4ð 	4ð4ð 4ð 4ð04ð 4ð 4ð4ð 4ð 4ð4ð 4ð 4ð 4ð 4r   r   Ú__main__)ÚbuiltinsÚ@py_builtinsÚ_pytest.assertion.rewriteÚ	assertionÚrewriteÚ
@pytest_arÚunittestÚfastapi.testclientr   Ú"app.modules.auth.presentation.authr   Úapp.mainr   ÚTestCaser   rH   Úmainr$   r   r   ú<module>rX      sº   ðØ  € € € € € € € € € € € € €€€€à )Ð )Ð )Ð )Ð )Ð )à ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø Ð Ð Ð Ð Ð ðL4ð L4ð L4ð L4ð L4˜Ô*ñ L4ô L4ð L4ð^ ˆzÒÐØ€H„M�O„O€O€O€Oð Ðr   