예제 #1
0
    def test_should_execute_show_help_callback_when_no_arguments_are_given(self):
        when(yadtshell.commandline.sys).exit(any_value()).thenReturn(None)

        ensure_command_has_required_arguments(
            'start', [], self.fake_show_help_callback)

        self.assertTrue(self._show_help_callback_has_been_called)
예제 #2
0
    def test_should_fail_when_executing_command_unignore_without_arguments(self):
        when(yadtshell.commandline.sys).exit(any_value()).thenReturn(None)

        ensure_command_has_required_arguments(
            'lock', [], self.fake_show_help_callback)

        verify(yadtshell.commandline.sys).exit(
            EXIT_CODE_MISSING_COMPONENT_URI_ARGUMENT)
예제 #3
0
    def test_should_not_exit_when_arguments_are_provided(self):
        when(yadtshell.commandline.sys).exit(any_value()).thenReturn(None)

        ensure_command_has_required_arguments(
            'start', ['service://hostname/service'], self.fake_show_help_callback)

        verify(yadtshell.commandline.sys, never).exit(
            EXIT_CODE_MISSING_COMPONENT_URI_ARGUMENT)
예제 #4
0
    def test_should_fail_when_executing_command_unignore_without_arguments(self):
        ensure_command_has_required_arguments(
            'lock', [], self.fake_show_help_callback)

        self.mock_exit.assert_called_with(
            EXIT_CODE_MISSING_COMPONENT_URI_ARGUMENT)
예제 #5
0
    def test_should_execute_show_help_callback_when_no_arguments_are_given(self):
        ensure_command_has_required_arguments(
            'start', [], self.fake_show_help_callback)

        self.assertTrue(self._show_help_callback_has_been_called)
예제 #6
0
    def test_should_not_exit_when_arguments_are_provided(self):
        ensure_command_has_required_arguments(
            'start', ['service://hostname/service'], self.fake_show_help_callback)

        self.mock_exit.assert_not_called()