
    Y.iG                         S SK r S SKr\ R                  R                  SS5        S SKJr  S SKJrJr   " S S\R                  5      r
 " S S	\R                  5      r\S
:X  a  \R                  " 5         gg)    NFLASK_SECRET_KEYztest-secret)Config)hash_passwordverify_passwordc                        \ rS rSrS rS rSrg)PasswordServiceTests
   c                 p    U R                  [        SS5      5        U R                  [        SS5      5        g )N123456654321)
assertTruer   assertFalse)selfs    XC:\Users\user\Desktop\Projetos_em_andamento\LojaOnline\tests\test_security_and_config.py*test_verify_password_with_plaintext_legacy?PasswordServiceTests.test_verify_password_with_plaintext_legacy   s*    (;<8<=    c                     [        S5      nU R                  [        US5      5        U R                  [        US5      5        g )Nzsenha-fortezsenha-incorreta)r   r   r   r   )r   hasheds     r   %test_verify_password_with_bcrypt_hash:PasswordServiceTests.test_verify_password_with_bcrypt_hash   s5    }->?1BCDr    N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r   r   r   r   r   
   s    >Er   r   c                        \ rS rSrS rS rSrg)ConfigValidationTests   c                     [         R                  n[         R                  n S[         l        S[         l        [         R                  " 5         U[         l        U[         l        g ! U[         l        U[         l        f = f)Ndevelopmentz
dev-secret)r   ENVIRONMENT
SECRET_KEYvalidate_requiredr   old_env
old_secrets      r   5test_validate_required_allows_development_with_secretKConfigValidationTests.test_validate_required_allows_development_with_secret   s]    $$&&
	+!.F ,F$$&!(F *F ")F *Fs   +A$ $A<c                 \   [         R                  n[         R                  n S[         l        S [         l        U R                  [        5         [         R
                  " 5         S S S 5        U[         l        U[         l        g ! , (       d  f       N%= f! U[         l        U[         l        f = f)N
production)r   r#   r$   assertRaisesRuntimeErrorr%   r&   s      r   4test_validate_required_requires_secret_in_productionJConfigValidationTests.test_validate_required_requires_secret_in_production!   sz    $$&&
	+!-F $F""<0((* 1 ")F *F	 10 ")F *Fs#   +B B#B 
BB B+r   N)r   r   r   r   r)   r/   r   r   r   r   r   r      s    	+
+r   r   __main__)osunittestenviron
setdefaultconfigr   services.passwordsr   r   TestCaser   r   r   mainr   r   r   <module>r:      sd    	  

  (- 8  =E8,, E+H-- +2 zMMO r   