Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.oldStepValue.parameterizedStepValue = 'Vowels in English language are .'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is <a> .'
request.refactorRequest.newStepValue.parameters.extend(['a', 'vowels'])
param1_position = ParameterPosition()
param1_position.oldPosition = -1
param1_position.newPosition = 0
param2_position = ParameterPosition()
param2_position.oldPosition = 0
param2_position.newPosition = 1
request.refactorRequest.paramPositions.extend([param1_position, param2_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
</a>
def test_Processor_refactor_request_with_add_param_and_only_invalid_identifier(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', '!%$'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
expected = """@step("Vowels in English language is .")
def test_Processor_refactor_request_with_add_and_remove_param(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is .'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {}.'
request.refactorRequest.newStepValue.parameters.extend(['bsdfdsf'])
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 0
request.refactorRequest.paramPositions.extend([param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
def test_Processor_refactor_request(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is .'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
request.refactorRequest.paramPositions.extend([position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
def test_Processor_refactor_request_with_add_param(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', 'bsdfdsf'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
def test_Processor_refactor_request_with_add_param(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', 'bsdfdsf'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
expected = """@step("Vowels in English language is .")
def test_Processor_refactor_request_with_add_param_and_only_invalid_identifier(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', '!%$'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
def test_Processor_refactor_request_with_add_param_and_invalid_identifier(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', 'vowels!2_ab%$'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],
response.refactorResponse.filesChanged)
expected = """@step("Vowels in English language is .")
def test_Processor_refactor_request_without_save_changes_add_param_and_invalid_identifier(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = False
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', 'vowels!2_ab%$'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
old_content = self.getActualText()
processor.refactor_step(request.refactorRequest, response, None)
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
def test_Processor_refactor_request_with_add_param_and_invalid_identifier(self):
response = Message()
request = Message()
request.refactorRequest.saveChanges = True
request.refactorRequest.oldStepValue.stepValue = 'Vowels in English language are {}.'
request.refactorRequest.oldStepValue.parameters.append('vowels')
request.refactorRequest.newStepValue.parameterizedStepValue = 'Vowels in English language is \
.'
request.refactorRequest.newStepValue.stepValue = 'Vowels in English language is {} {}.'
request.refactorRequest.newStepValue.parameters.extend(['vowels', 'vowels!2_ab%$'])
position = ParameterPosition()
position.oldPosition = 0
position.newPosition = 0
param_position = ParameterPosition()
param_position.oldPosition = -1
param_position.newPosition = 1
request.refactorRequest.paramPositions.extend([position, param_position])
processor.refactor_step(request.refactorRequest, response, None)
actual_data = self.getActualText()
self.assertEqual(Message.RefactorResponse, response.messageType)
self.assertEqual(True,
response.refactorResponse.success,
response.refactorResponse.error)
self.assertEqual([RefactorTests.path],