auth-framework 0.4.2

A comprehensive, production-ready authentication and authorization framework for Rust applications
Documentation
�

�N�h��6�SrSSKrSSKJs Jr SSKrSSKrSSK	r	SSK
Jr SSKJ
r
Jr \R"\5rSSjrSSjrSSjrSSjrSS	jrSS
jr\S:Xa:\R0"\R2SS
9 \"5 \R4"\"55 gg)zkBasic tests for AuthFramework client architecture.

Copyright (c) 2025 AuthFramework. All rights reserved.
�N)�	MagicMock)�AuthFrameworkClient�
BaseClientc��[S5n[US5(d
Sn[U5e[US5(d
Sn[U5e[US5(d
Sn[U5e[US5(d
S	n[U5e[US
5(d
Sn[U5e[US5(d
S
n[U5eg)z�Test client initialization with proper service composition.

Raises:
    AssertionError: If any required service or base client is missing.
    TypeError: If client internal structure is invalid.

�https://api.test.com�authzClient missing 'auth' service�userzClient missing 'user' service�mfazClient missing 'mfa' service�oauthzClient missing 'oauth' service�adminzClient missing 'admin' service�_clientz"Client missing '_client' attributeN)r�hasattr�AssertionError�	TypeError��client�msgs  �_c:\Users\cires\OneDrive\Documents\projects\AuthFramework\sdks\python\tests\test_architecture.py�test_client_initializationrs���!�!7�
8�F��6�6�"�"�-���S�!�!��6�6�"�"�-���S�!�!��6�5�!�!�,���S�!�!��6�7�#�#�.���S�!�!��6�7�#�#�.���S�!�!��6�9�%�%�2����n��&�c���# �[S5IShv�Nn[US5(d
Sn[U5eSSS5IShv�N gN3N!,IShv�N(df   g=f7f)zoTest client works as async context manager.

Raises:
    AssertionError: If client missing required services.

rNrz0Client missing 'auth' service in context manager)rrrrs  r�test_client_context_managerr2sF���#�#9�:�:�f��v�v�&�&�D�C� ��%�%�;�:�:�:�:�:�sC�A$�A�A$�A
�A$�A�A$�A$�
A!�A�A!�A$c�d�[S5n[RRSS5nUR	U5 UR5U:wa!SUSUR53n[
U5eUR5 UR5bSUR53n[
U5eg)zoTest client token management functionality.

Raises:
    AssertionError: If token management operations fail.

r�
TEST_TOKENzmock-test-token-123zExpected token z, got Nz(Expected None after clearing token, got )r�os�environ�get�set_access_token�get_access_tokenr�clear_access_token)r�
test_tokenrs   r�test_token_managementr"?s���!�!7�
8�F�������.C�D�J�
���J�'�
��� �J�.��
�|�6�&�2I�2I�2K�1L�M���S�!�!�����
��� �,�8��9P�9P�9R�8S�T���S�!�!�-rc�p�[S5n[[S9n[US5(d
Sn[	U5eg)zoTest service separation and composition.

Raises:
    AssertionError: If service separation validation fails.

r)�specr
z$Client missing base client interfaceN)rrrrr)r�_base_clientrs   r�test_service_separationr&Xs?��!�!7�
8�F��*�-�L��6�9�%�%�4���S�!�!�&rc���[RS5 [5 [RS5 [5 [RS5 [	5 [RS5 g)zRun basic functionality tests.z#Running basic architecture tests...u%✓ Client initialization test passedu ✓ Token management test passedu'✓ Architecture separation test passedN)�logger�inforr"r&�rr�test_basic_functionalityr+ksH��
�K�K�5�6�� �
�K�K�7�8���
�K�K�2�3���
�K�K�9�:rc���# �[5IShv�N [RS5 [RS5 [RS5 [RS5 [RS5 [RS5 [RS5 [RS	5 [RS
5 gN�![a [R	S5 ef=f7f)zRun all architecture tests.Nu$
🎉 All architecture tests passed!z!
Architecture validation summary:uB✅ Main client has only 6 essential methods (well under 20 limit)u:✅ Services are properly separated with no method overlapu.✅ Each service has distinct responsibilitiesu$✅ Token management works correctlyu'✅ Context manager pattern implementedu0✅ Error handling is consistent and informativez-
The architectural issues have been resolved!zArchitecture test failed)rr(r)�	Exception�	exceptionr*rr�	test_mainr/ws�����)�+�+�+����;�<����8�9����X�Y����P�Q����D�E����:�;����=�>����F�G����D�E�	,�������3�4�
��s-�C:�
C�C�CC�C:�C�!C7�7C:�__main__z%(message)s)�level�format)�returnN)�__doc__�builtins�@py_builtins�_pytest.assertion.rewrite�	assertion�rewrite�
@pytest_ar�asyncio�loggingr�
unittest.mockr�authframework.clientrr�	getLogger�__name__r(rrr"r&r+r/�basicConfig�INFO�runr*rr�<module>rDs����
����	�#�@�
�	�	�8�	$���B
&�"�2"�&	;��*�z�����g�l�l�=�A����K�K�	���r