
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr   " S
 S\	R                  5      r " S S\R                   5      rg)zTests for command.py.    )absolute_import)print_function)division)unicode_literals)mock)command)testcase)	constantsc            	           \ rS rSrSr\R                  R                  SS\R                  SSS9r
\R                  R                  S/ SS	S
0 S9rSrg)FakeGsutilCommand   z(Implementation of a fake gsutil command.fake_gsutil   zrz:T)min_argsmax_argssupported_sub_argsfile_url_okcommand_helpz&Fake one line summary for the command.zHelp text for fake command.)	help_namehelp_name_aliases	help_typehelp_one_line_summary	help_textsubcommand_help_text N)__name__
__module____qualname____firstlineno____doc__r   CommandCreateCommandSpecr
   NO_MAXcommand_specHelpSpec	help_spec__static_attributes__r       +platform/gsutil/gslib/tests/test_command.pyr   r      s`    022=<=<E<L<LFK?C	 3 E,
 oo&&D- ' )r(   r   c                   z   ^  \ rS rSrSrU 4S jrS rS r\R                  R                  \SSS9S	 5       rS
rU =r$ )TestParseSubOpts.   zfTest Command.ParseSubOpts method.

Only testing cases which are not tested indirectly by other tests.
c                   > [         TU ]  5         [        [        R                  / SQ0 [        R                  [        R                  [        R                  [        R                  [        R
                  " 5       S9U l        g )Nz-zopt1z-rarg1arg2command_runnerargsheadersdebugtrace_tokenparallel_operationsbucket_storage_uri_classgsutil_api_class_map_factory)supersetUpr   r   ANY	MagicMock_fake_command)self	__class__s    r)   r<   TestParseSubOpts.setUp4   sL    	GMO*xx1hhHH HH!%%)^^%57Dr(   c                     U R                  [        S5         U R                  R                  SSS9  S S S 5        g ! , (       d  f       g = f)NzIRequested to check arguments but sub_opts and args have not been updated.TF)
check_argsshould_update_sub_opts_and_args)assertRaisesRegex	TypeErrorr?   ParseSubOpts)r@   s    r)   Htest_raises_error_with_check_args_set_and_update_sub_opts_and_args_unsetYTestParseSubOpts.test_raises_error_with_check_args_set_and_update_sub_opts_and_args_unset@   sI    			 
 %%FK & M
 
 
s	   ;
A	c                     SS/nXR                   l        U R                   R                  SS9u  p#U R                  X15        g )Nfaker4   F)rE   )r?   r4   rH   assertEqual)r@   	args_list_parsed_argss       r)   *test_uses_self_args_if_args_passed_is_None;TestParseSubOpts.test_uses_self_args_if_args_passed_is_NoneH   sF     I'''44(- 5 /NA[,r(   CreateOrGetGsutilLoggerT)autospecc                    SUR                   R                  l         [        [        R                  / SQ0 [        R                  [        R                  [        R                  [        R                  [        R
                  " 5       S9U l        U R                  U R                  R                  5        UR                  S5        g )NFr.   r2   r   )
return_valueisEnabledForr   r   r=   r>   r?   
assertTrue
quiet_modeassert_called_once_with)r@   mock_loggers     r)   test_quiet_mode_gets_set)TestParseSubOpts.test_quiet_mode_gets_setO   s~    9>K))6*xx1hhHH HH!%%)^^%57D 	OOD&&112''6r(   )r?   )r   r   r   r   r    r<   rI   rQ   r   patchobjectr   r\   r'   __classcell__)rA   s   @r)   r+   r+   .   sD    

7M- ::W7$G7 H7r(   r+   N)r    
__future__r   r   r   r   unittestr   gslibr   gslib.testsr	   gslib.utilsr
   r!   r   GsUtilUnitTestCaser+   r   r(   r)   <module>rg      sD     & %  '     ! ".7x22 .7r(   