
    i
                        d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	 ej                  j                  d e ee      j                  j                               ddlZddlZddlZddlZ G d dej&                        Z G d dej&                        Z G d	 d
ej&                        Z G d dej&                        Zedk(  r ej2                          yy)u>   main() 함수 직접 호출 테스트 - 커버리지 개선용    N)Path)patchc                       e Zd ZdZd Zd Zy)TestBaseReviewerMainu(   base_reviewer.py main() 함수 테스트c                     t        dddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)   main() 함수 - test 인자sys.argvbase_reviewer.pytest
sys.stdoutnew_callableNr   ioStringIObase_reviewermainselfs    =/home/jay/workspace/memory/red_team/tests/test_main_direct.pytest_main_with_test_argz,TestBaseReviewerMain.test_main_with_test_arg   [    : 2F;< 	%|"++> %""$%	% 	%% %	% 	%"   AA AA	AA&c                     t        ddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)   main() 함수 - 인자 없음r	   r
   r   r   Nr   r   s    r   test_main_without_argsz+TestBaseReviewerMain.test_main_without_args   sY    : 234 	%|"++> %""$%	% 	%% %	% 	%!   AAAA	AA%N__name__
__module____qualname____doc__r   r        r   r   r      s    2%%r$   r   c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)TestCodeReviewerMainu(   code_reviewer.py main() 함수 테스트c                     t        ddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)r   r	   code_reviewer.pyNr   assertRaises
SystemExitcode_reviewerr   r   s    r   r   z+TestCodeReviewerMain.test_main_without_args(   sY    : 234 	%"":. %""$%	% 	%% %	% 	%!   AA
A
A	AAc                     t        dddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)   main() 함수 - test 명령r	   r(   r   r   r   N)r   r   r   r,   r   r   s    r   test_main_test_commandz+TestCodeReviewerMain.test_main_test_command.   r   r   c                     t        dddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)u+   main() 함수 - scan 명령 (파일 없음)r	   r(   scanNr)   r   s    r   test_main_scan_without_filez0TestCodeReviewerMain.test_main_scan_without_file4   s[    : 2F;< 	%"":. %""$%	% 	%% %	% 	%!   AAAA	AA c                    t        j                  ddd      5 }|j                  d       |j                  }ddd       	 t	        ddd	g      5  t	        d
t
        j                        5  t        j                          ddd       ddd       t        j                  |       y# 1 sw Y   pxY w# 1 sw Y   3xY w# 1 sw Y   7xY w# t        j                         w xY w)u+   main() 함수 - scan 명령 (파일 있음)w.pyFmodesuffixdelete# test
pass
Nr	   r(   r2   r   r   )tempfileNamedTemporaryFilewritenamer   r   r   r,   r   osunlinkr   f	temp_paths      r   test_main_scan_with_filez-TestCodeReviewerMain.test_main_scan_with_file:   s    ((c%N 	RSGG$%I		!z$6	#JK )<bkkB )!&&()) IIi 	 	) )) ) IIi sG   B& C
 B>+B2 B>C
 &B/2B;	7B>>CC
 
C!c                     t        dddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)%   main() 함수 - 알 수 없는 명령r	   r(   unknown_cmdNr)   r   s    r   test_main_unknown_commandz.TestCodeReviewerMain.test_main_unknown_commandG   s[    : 2MBC 	%"":. %""$%	% 	%% %	% 	%r4   N)	r   r    r!   r"   r   r0   r3   rF   rJ   r#   r$   r   r&   r&   %   s    2%%%!%r$   r&   c                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	TestRedTeamOrchestratorMainu0   red_team_orchestrator.py main() 함수 테스트c                     t        ddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)r   r	   red_team_orchestrator.pyNr   r*   r+   red_team_orchestratorr   r   s    r   r   z2TestRedTeamOrchestratorMain.test_main_without_argsQ   sY    : :;< 	-"":. -%**,-	- 	-- -	- 	-r-   c                     t        dddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)u   main() 함수 - types 명령r	   rN   typesr   r   Nr   r   r   rP   r   r   s    r   test_main_types_commandz3TestRedTeamOrchestratorMain.test_main_types_commandW   s[    : :GDE 	-|"++> -%**,-	- 	-- -	- 	-r   c                     t        dddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)r/   r	   rN   r   r   r   NrS   r   s    r   r0   z2TestRedTeamOrchestratorMain.test_main_test_command]   s[    : :FCD 	-|"++> -%**,-	- 	-- -	- 	-r   c                     t        dddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)u-   main() 함수 - review 명령 (인자 부족)r	   rN   reviewNrO   r   s    r   test_main_review_without_argsz9TestRedTeamOrchestratorMain.test_main_review_without_argsc   s[    : :HEF 	-"":. -%**,-	- 	-- -	- 	-r4   c                    t        j                  ddd      5 }|j                  d       |j                  }ddd       	 t	        ddd	d
g      5  t	        dt
        j                        5  t        j                          ddd       ddd       t        j                  |       y# 1 sw Y   qxY w# 1 sw Y   3xY w# 1 sw Y   7xY w# t        j                         w xY w)u&   main() 함수 - review 명령 (정상)r6   r7   Fr8   r<   Nr	   rN   rW   coder   r   )r=   r>   r?   r@   r   r   r   rP   r   rA   rB   rC   s      r   test_main_review_with_argsz6TestRedTeamOrchestratorMain.test_main_review_with_argsi   s    ((c%N 	RSGG$%I		!z$>&R[#\] 1<bkkB 1)..011 IIi 	 	1 11 1 IIi sG   B' C B?,B3B?	C 'B03B<	8B??CC C"c                     t        dddg      5  | j                  t              5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)rH   r	   rN   rI   NrO   r   s    r   rJ   z5TestRedTeamOrchestratorMain.test_main_unknown_commandv   s[    : :MJK 	-"":. -%**,-	- 	-- -	- 	-r4   N)
r   r    r!   r"   r   rT   r0   rX   r[   rJ   r#   r$   r   rL   rL   N   s#    :----!-r$   rL   c                       e Zd ZdZd Zd Zy)TestSecurityPatternsMainu,   security_patterns.py main() 함수 테스트c                     t        dddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)r   r	   security_patterns.pyr   r   r   Nr   r   r   security_patternsr   r   s    r   r   z0TestSecurityPatternsMain.test_main_with_test_arg   s[    : 6?@ 	)|"++> )!&&()	) 	)) )	) 	)r   c                     t        ddg      5  t        dt        j                        5  t        j                          ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)r   r	   r`   r   r   Nra   r   s    r   r   z/TestSecurityPatternsMain.test_main_without_args   sY    : 678 	)|"++> )!&&()	) 	)) )	) 	)r   Nr   r#   r$   r   r^   r^   }   s    6))r$   r^   __main__)r"   r   rA   sysr=   unittestpathlibr   unittest.mockr   pathinsertstr__file__parentr   r,   rP   rb   TestCaser   r&   rL   r^   r   r   r#   r$   r   <module>ro      s    D 	 	 
     3tH~,,334 5    %8,, % &%8,, &%R,-("3"3 ,-^)x00 )  zHMMO r$   