Example #1
0
    def test_LspServerHandler_implement_stub(self):
        handler = LspServerHandler(None)
        content = "@step('foo')\ndef foo():\n\tpass\n"
        ast = loader.generate_ast(content, 'foo.py')
        loader.load_steps(ast, 'foo.py')

        req = StubImplementationCodeRequest(**{'implementationFilePath': 'New File', 'codes': ['add hello']})
        res = handler.ImplementStub(req, None)
        self.assertEqual(os.path.basename(res.filePath), 'step_implementation.py')
        self.assertEqual(res.textDiffs[0].content, 'from getgauge.python import step\n\nadd hello')
Example #2
0
    def test_LspServerHandler_implement_stub(self):
        handler = LspServerHandler(None)
        self.load_content_steps("@step('foo')\ndef foo():\n\tpass\n")

        req = StubImplementationCodeRequest(
            implementationFilePath='New File', codes=['add hello'])
        res = handler.ImplementStub(req, None)
        self.assertEqual(os.path.basename(res.filePath),
                         'step_implementation.py')
        self.assertEqual(
            res.textDiffs[0].content, 'from getgauge.python import step\n\nadd hello')