Beispiel #1
0
    def test_Processor_step_name_request(self):
        registry.add_step('Step <a> with <b>', 'func', '', {
            'start': 1,
            'startChar': 0,
            'end': 3,
            'endChar': 10
        })
        registry.add_step('Step 4', 'func1', '', {
            'start': 5,
            'startChar': 0,
            'end': 6,
            'endChar': 10
        })
        request = StepNameRequest()
        request.stepValue = 'Step {} with {}'

        response = processor.process_step_name_request(request)
        self.assertTrue(isinstance(response, StepNameResponse))
        self.assertEqual(['Step <a> with <b>'], response.stepName)
        self.assertEqual(True, response.isStepPresent)
        request = StepNameRequest()
        self.assertEqual(False, response.hasAlias)

        request.stepValue = 'Step 4'
        response = processor.process_step_name_request(request)

        self.assertTrue(isinstance(response, StepNameResponse))
        self.assertEqual(['Step 4'], response.stepName)
        self.assertEqual(True, response.isStepPresent)
        self.assertEqual(False, response.hasAlias)
Beispiel #2
0
    def test_Processor_step_name_request_with_unimplemented_step(self):
        request = StepNameRequest()
        request.stepValue = 'Step {} with {}'

        response = processor.process_step_name_request(request)

        self.assertTrue(isinstance(response, StepNameResponse))
        self.assertEqual([], response.stepName)
        self.assertEqual(False, response.isStepPresent)
        self.assertEqual(False, response.hasAlias)
Beispiel #3
0
    def test_Processor_process_step_name_request(self):
        self.load_content_steps('''\
        @step('foo')
        def foo():
            pass
        ''')

        req = StepNameRequest(stepValue='foo')
        res = processor.process_step_name_request(req)

        self.assertTrue(res.isStepPresent)
        self.assertEqual(res.fileName, 'foo.py')
Beispiel #4
0
    def test_Processor_step_name_request_with_aliases(self):
        registry.add_step(['Step 1', 'Step 2', 'Step 3'], 'func1', '', {
            'start': 5,
            'startChar': 0,
            'end': 6,
            'endChar': 10
        })
        request = StepNameRequest()
        request.stepValue = 'Step 1'

        response = processor.process_step_name_request(request)

        self.assertTrue(isinstance(response, StepNameResponse))
        self.assertTrue('Step 1' in response.stepName)
        self.assertTrue('Step 2' in response.stepName)
        self.assertTrue('Step 3' in response.stepName)
        self.assertEqual(True, response.isStepPresent)
        self.assertEqual(True, response.hasAlias)
Beispiel #5
0
 def GetStepName(self, request, context):
     return processor.process_step_name_request(request)