Example #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),
    ]
Example #2
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),
    ]
Example #3
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()
Example #4
0
 def test_unknown_instruction(self):
     instructions = ['known-instruction']
     application_help = application_help_for(
         [section_documentation('phase', instructions)])
     with self.assertRaises(HelpError):
         sut.parse(
             application_help,
             arguments_for.case_instruction_search('unknown-instruction'))
Example #5
0
 def test_instruction_in_single_phase(self):
     application_help = application_help_for([section_documentation('phase-a', ['a-instruction']),
                                              section_documentation('phase-with-target', ['target-instruction'])])
     actual = sut.parse(application_help, arguments_for.case_instruction_search('target-instruction'))
     actual = self._assert_is_valid_instruction_list_settings('target-instruction',
                                                              actual)
     self.assertEqual(1,
                      len(actual.data),
                      'One instruction is expected to be found')
     self.assertEqual('phase-with-target',
                      actual.data[0][0].plain,
                      'The instruction is expected to be found in the %s phase.' % 'phase-with-target')
Example #6
0
 def test_instruction_in_single_phase(self):
     application_help = application_help_for([
         section_documentation('phase-a', ['a-instruction']),
         section_documentation('phase-with-target', ['target-instruction'])
     ])
     actual = sut.parse(
         application_help,
         arguments_for.case_instruction_search('target-instruction'))
     actual = self._assert_is_valid_instruction_list_settings(
         'target-instruction', actual)
     self.assertEqual(1, len(actual.data),
                      'One instruction is expected to be found')
     self.assertEqual(
         'phase-with-target', actual.data[0][0].plain,
         'The instruction is expected to be found in the %s phase.' %
         'phase-with-target')
Example #7
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()
Example #8
0
 def test_instruction_in_multiple_phase(self):
     application_help = application_help_for([
         section_documentation('phase-a', ['a-instr']),
         section_documentation('phase-b', ['the-instr']),
         section_documentation('phase-c', ['c-instr']),
         section_documentation('phase-d', ['the-instr']),
     ])
     actual = sut.parse(application_help,
                        arguments_for.case_instruction_search('the-instr'))
     actual = self._assert_is_valid_instruction_list_settings('the-instr',
                                                              actual)
     self.assertEqual(2,
                      len(actual.data),
                      'Two instructions are expected to be found')
     self.assertEqual('phase-b',
                      actual.data[0][0].plain,
                      'The first instruction is expected to be found in the %s phase.' % 'phase-b')
     self.assertEqual('phase-d',
                      actual.data[1][0].plain,
                      'The second instruction is expected to be found in the %s phase.' % 'phase-d')
Example #9
0
 def test_instruction_in_multiple_phase(self):
     application_help = application_help_for([
         section_documentation('phase-a', ['a-instr']),
         section_documentation('phase-b', ['the-instr']),
         section_documentation('phase-c', ['c-instr']),
         section_documentation('phase-d', ['the-instr']),
     ])
     actual = sut.parse(application_help,
                        arguments_for.case_instruction_search('the-instr'))
     actual = self._assert_is_valid_instruction_list_settings(
         'the-instr', actual)
     self.assertEqual(2, len(actual.data),
                      'Two instructions are expected to be found')
     self.assertEqual(
         'phase-b', actual.data[0][0].plain,
         'The first instruction is expected to be found in the %s phase.' %
         'phase-b')
     self.assertEqual(
         'phase-d', actual.data[1][0].plain,
         'The second instruction is expected to be found in the %s phase.' %
         'phase-d')
Example #10
0
 def test_unknown_instruction(self):
     instructions = ['known-instruction']
     application_help = application_help_for([section_documentation('phase', instructions)])
     with self.assertRaises(HelpError):
         sut.parse(application_help,
                   arguments_for.case_instruction_search('unknown-instruction'))