Beispiel #1
0
def _global_test_cases() -> list:
    return [
        ProcessTestCase('help for "case cli syntax" SHOULD be successful',
                        HelpInvokation(arguments_for.case_cli_syntax()),
                        RESULT_IS_SUCCESSFUL),
        ProcessTestCase('help for "case specification" SHOULD be successful',
                        HelpInvokation(arguments_for.case_specification()),
                        RESULT_IS_SUCCESSFUL),
        ProcessTestCase(
            'help for "case instruction in phase" SHOULD be successful',
            HelpInvokation(
                arguments_for.case_instruction_in_phase(
                    phase_identifier.SETUP.identifier,
                    CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL),
        ProcessTestCase(
            'help for "phase specification" SHOULD be successful',
            HelpInvokation(
                arguments_for.case_phase_for_name(
                    phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL),
        ProcessTestCase(
            'help for "phase instruction list" SHOULD be successful',
            HelpInvokation(
                arguments_for.case_instructions_in_phase(
                    phase_identifier.SETUP.identifier)), RESULT_IS_SUCCESSFUL),
        ProcessTestCase(
            'help for "case instruction list" SHOULD be successful',
            HelpInvokation(arguments_for.case_instructions()),
            RESULT_IS_SUCCESSFUL),
        ProcessTestCase(
            'help for "case instruction search" SHOULD be successful',
            HelpInvokation(
                arguments_for.case_instruction_search(
                    CHANGE_DIR_INSTRUCTION_NAME)), RESULT_IS_SUCCESSFUL),
    ]
Beispiel #2
0
 def test_unknown_phase(self):
     application_help = application_help_for([
         section_documentation('phase', ['instruction-name'])
     ])
     with self.assertRaises(HelpError):
         sut.parse(application_help,
                   arguments_for.case_instruction_in_phase('non-existing-phase', 'instruction-name'))
Beispiel #3
0
def _global_test_cases() -> list:
    return [
        ProcessTestCase('help for "case cli syntax" SHOULD be successful',
                        HelpInvokation(arguments_for.case_cli_syntax()),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "case specification" SHOULD be successful',
                        HelpInvokation(arguments_for.case_specification()),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "case instruction in phase" SHOULD be successful',
                        HelpInvokation(arguments_for.case_instruction_in_phase(
                            phase_identifier.SETUP.identifier,
                            CHANGE_DIR_INSTRUCTION_NAME)),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "phase specification" SHOULD be successful',
                        HelpInvokation(arguments_for.case_phase_for_name(phase_identifier.SETUP.identifier)),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "phase instruction list" SHOULD be successful',
                        HelpInvokation(
                            arguments_for.case_instructions_in_phase(phase_identifier.SETUP.identifier)),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "case instruction list" SHOULD be successful',
                        HelpInvokation(arguments_for.case_instructions()),
                        RESULT_IS_SUCCESSFUL),

        ProcessTestCase('help for "case instruction search" SHOULD be successful',
                        HelpInvokation(arguments_for.case_instruction_search(CHANGE_DIR_INSTRUCTION_NAME)),
                        RESULT_IS_SUCCESSFUL),
    ]
Beispiel #4
0
    def synopsises(self) -> List[cli_syntax.Synopsis]:
        non_entities_help = [
            _synopsis([], 'Gives a brief description of the program.'),
            _synopsis([_c(clo.HELP)], 'Displays this help.'),
            _synopsis([_c(clo.HTML_DOCUMENTATION)],
                      'Generates a HTML version of all help information available in the program.'),
            _synopsis(_ns(arguments_for.case_cli_syntax()), 'Describes the test case command line syntax.'),
            _synopsis(_ns(arguments_for.case_specification()), 'Specification of the test case functionality.'),

            _synopsis(_ns(arguments_for.case_phase_for_name('PHASE')), 'Describes a test case phase.'),
            _synopsis(_ns(arguments_for.case_instructions_in_phase('PHASE')),
                      'Lists instructions in PHASE.'),
            _synopsis(_ns(arguments_for.case_instruction_in_phase('PHASE', 'INSTRUCTION')),
                      'Describes an instruction in a test case phase.'),

            _synopsis(_ns(arguments_for.case_instructions()),
                      'Lists instructions per test case phase.'),
            _synopsis(_ns(arguments_for.case_instruction_search('INSTRUCTION')),
                      'Describes all test case instructions with the given name.'),
            _synopsis(_ns(arguments_for.suite_cli_syntax()), 'Describes the test suite command line syntax.'),
            _synopsis(_ns(arguments_for.suite_specification()),
                      'Specification of the test suite functionality.'),
            _synopsis(_ns(arguments_for.suite_section_for_name('SECTION')), 'Describes a test suite section.'),
            _synopsis(_ns(arguments_for.suite_instruction_in_section('SECTION', 'INSTRUCTION')),
                      'Describes an instruction in a test suite section.'),
            _synopsis(_ns(arguments_for.symbol_cli_syntax()),
                      'Describes the symbol usages report command line syntax.'),
        ]

        return non_entities_help + self._entities_help()
Beispiel #5
0
 def test_unknown_phase(self):
     application_help = application_help_for(
         [section_documentation('phase', ['instruction-name'])])
     with self.assertRaises(HelpError):
         sut.parse(
             application_help,
             arguments_for.case_instruction_in_phase(
                 'non-existing-phase', 'instruction-name'))
Beispiel #6
0
 def test_unknown_instruction(self):
     application_help = application_help_for([
         section_documentation('phase-1', ['instruction']),
         section_documentation('empty-phase', []),
     ])
     with self.assertRaises(HelpError):
         sut.parse(application_help,
                   arguments_for.case_instruction_in_phase('empty-phase', 'instruction'))
Beispiel #7
0
 def test_phase_without_instructions(self):
     phase_name = 'phase'
     application_help = application_help_for([
         SectionDocumentationForSectionWithoutInstructionsTestImpl(phase_name),
     ])
     with self.assertRaises(HelpError):
         sut.parse(application_help,
                   arguments_for.case_instruction_in_phase(phase_name, 'instruction'))
Beispiel #8
0
 def test_unknown_instruction(self):
     application_help = application_help_for([
         section_documentation('phase-1', ['instruction']),
         section_documentation('empty-phase', []),
     ])
     with self.assertRaises(HelpError):
         sut.parse(
             application_help,
             arguments_for.case_instruction_in_phase(
                 'empty-phase', 'instruction'))
Beispiel #9
0
 def test_phase_without_instructions(self):
     phase_name = 'phase'
     application_help = application_help_for([
         SectionDocumentationForSectionWithoutInstructionsTestImpl(
             phase_name),
     ])
     with self.assertRaises(HelpError):
         sut.parse(
             application_help,
             arguments_for.case_instruction_in_phase(
                 phase_name, 'instruction'))
Beispiel #10
0
 def _assert_is_existing_instruction_in_phase(
         self, application_help: ApplicationHelp, phase_name: str,
         instruction_name: str):
     actual = sut.parse(
         application_help,
         arguments_for.case_instruction_in_phase(phase_name,
                                                 instruction_name))
     actual = self._check_is_test_case_settings_for_single_instruction(
         actual)
     self.assertEqual(actual.name, instruction_name, 'Name of instruction')
     single_line_desc_str = actual.data.single_line_description()
     self.assertEqual(
         single_line_description_that_identifies_instruction_and_section(
             phase_name, instruction_name), single_line_desc_str,
         'The single-line-description in this test is expected to identify (phase,instruction-name)'
     )
Beispiel #11
0
 def _assert_is_existing_instruction_in_phase(self,
                                              application_help: ApplicationHelp,
                                              phase_name: str,
                                              instruction_name: str):
     actual = sut.parse(application_help,
                        arguments_for.case_instruction_in_phase(phase_name,
                                                                instruction_name))
     actual = self._check_is_test_case_settings_for_single_instruction(actual)
     self.assertEqual(actual.name,
                      instruction_name,
                      'Name of instruction')
     single_line_desc_str = actual.data.single_line_description()
     self.assertEqual(single_line_description_that_identifies_instruction_and_section(phase_name,
                                                                                      instruction_name),
                      single_line_desc_str,
                      'The single-line-description in this test is expected to identify (phase,instruction-name)')
Beispiel #12
0
    def synopses(self) -> List[cli_syntax.Synopsis]:
        non_entities_help = [
            _synopsis([], 'Gives a brief description of the program.'),
            _synopsis([_c(clo.HELP)], 'Displays this help.'),
            _synopsis([
                _c(clo.HTML_DOCUMENTATION)
            ], 'Generates a HTML version of all help information available in the program.'
                      ),
            _synopsis(_ns(arguments_for.case_cli_syntax()),
                      'Describes the test case command line syntax.'),
            _synopsis(_ns(arguments_for.case_specification()),
                      'Specification of the test case functionality.'),
            _synopsis(_ns(arguments_for.case_phase_for_name('PHASE')),
                      'Describes a test case phase.'),
            _synopsis(_ns(arguments_for.case_instructions_in_phase('PHASE')),
                      'Lists instructions in PHASE.'),
            _synopsis(
                _ns(
                    arguments_for.case_instruction_in_phase(
                        'PHASE', 'INSTRUCTION')),
                'Describes an instruction in a test case phase.'),
            _synopsis(_ns(arguments_for.case_instructions()),
                      'Lists instructions per test case phase.'),
            _synopsis(
                _ns(arguments_for.case_instruction_search('INSTRUCTION')),
                'Describes all test case instructions with the given name.'),
            _synopsis(_ns(arguments_for.suite_cli_syntax()),
                      'Describes the test suite command line syntax.'),
            _synopsis(_ns(arguments_for.suite_specification()),
                      'Specification of the test suite functionality.'),
            _synopsis(_ns(arguments_for.suite_section_for_name('SECTION')),
                      'Describes a test suite section.'),
            _synopsis(
                _ns(
                    arguments_for.suite_instruction_in_section(
                        'SECTION', 'INSTRUCTION')),
                'Describes an instruction in a test suite section.'),
            _synopsis(
                _ns(arguments_for.symbol_cli_syntax()),
                'Describes the symbol usages report command line syntax.'),
        ]

        return non_entities_help + self._entities_help()
Beispiel #13
0
 def visit_test_case_phase_instruction(
         self,
         x: concrete_cross_refs.TestCasePhaseInstructionCrossReference):
     return _command_line_display_for_help_arguments(
         arguments_for.case_instruction_in_phase(x.phase_name,
                                                 x.instruction_name))
Beispiel #14
0
 def visit_test_case_phase_instruction(self, x: concrete_cross_refs.TestCasePhaseInstructionCrossReference):
     return _command_line_display_for_help_arguments(arguments_for.case_instruction_in_phase(x.phase_name,
                                                                                             x.instruction_name))