
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	c m
Z
  G d d	e
j                        Z G d
 de
j                        Zy)zUnit tests for help command.    )absolute_import)print_function)division)unicode_literals)CommandNc                   @    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)HelpUnitTestszHelp command unit test suite.c                 N    | j                  dd      }| j                  d|       y )NhelpTreturn_stdoutzAvailable commands
RunCommandassertInselfstdouts     (platform/gsutil/gslib/tests/test_help.pytest_help_noargszHelpUnitTests.test_help_noargs$   s#    __V4_8FMM&/    c                 x    | j                  dddgd      }| j                  d|       | j                  d|       y )Nr   websetTr   gsutil web setgsutil web getr   r   assertNotInr   s     r   test_help_subcommand_argz&HelpUnitTests.test_help_subcommand_arg(   s:    __VeU^4_HFMM"F+%v.r   c                 T    | j                  dddgd      }| j                  d|       y )Nr   r   asdfTr   z!help about one of the subcommandsr   r   s     r    test_help_invalid_subcommand_argz.HelpUnitTests.test_help_invalid_subcommand_arg-   s)    __VeV_D_IFMM5v>r   c                 T    | j                  dddgd      }| j                  d|       y )Nr   lsr    Tr   zhas no subcommandsr   r   s     r   9test_help_with_subcommand_for_command_without_subcommandszGHelpUnitTests.test_help_with_subcommand_for_command_without_subcommands1   s)    __VdF^4_HFMM&/r   c                 R    | j                  ddgd      }| j                  d|       y )Nr   r#   Tr   ls - List providers, bucketsr   r   s     r   test_help_command_argz#HelpUnitTests.test_help_command_arg5   s'    __VdV4_@FMM0&9r   c                 R    | j                  ddgd      }| j                  d|       y )Nr#   --helpTr   r&   r   r   s     r   test_command_help_argz#HelpUnitTests.test_command_help_arg9   s'    __TH:T_BFMM0&9r   c                 x    | j                  dddgd      }| j                  d|       | j                  d|       y )Nr   r   r)   Tr   r   r   r   r   s     r   test_subcommand_help_argz&HelpUnitTests.test_subcommand_help_arg=   s;    __UUH$5T_JFMM"F+%v.r   c                 T    | j                  dg dd      }| j                  d|       y )Ncp)foobarr)   Tr   zcp - Copy files and objectsr   r   s     r   test_command_args_with_helpz)HelpUnitTests.test_command_args_with_helpB   s&    __T#;4_PFMM/8r   N)__name__
__module____qualname____doc__r   r   r!   r$   r'   r*   r,   r1    r   r   r	   r	   !   s-    %0/
?0::/
9r   r	   c                       e Zd ZdZd Zd Zy)HelpIntegrationTestsz$Help command integration test suite.c                 R    | j                  dgdd      }| j                  d|       y )Nr.   T   )return_stderrexpected_statuszUsage:)	RunGsUtilr   )r   stderrs     r   test_help_wrong_num_argsz-HelpIntegrationTests.test_help_wrong_num_argsJ   s&    ^^TF$^JFMM(F#r   c                     t        j                         D ])  }| j                  d|j                  j                  g       + y )Nr   )r   __subclasses__r=   command_speccommand_name)r   commands     r   test_help_runs_for_all_commandsz4HelpIntegrationTests.test_help_runs_for_all_commandsN   s4     ))+
nnfg22??@A ,r   N)r2   r3   r4   r5   r?   rE   r6   r   r   r8   r8   G   s    ,$Br   r8   )r5   
__future__r   r   r   r   gslib.commandr   gslib.tests.testcaseteststestcaseGsUtilUnitTestCaser	   GsUtilIntegrationTestCaser8   r6   r   r   <module>rM      sF   , # & %  ' ! ' '#9H// #9LB8== Br   