Ejemplo n.º 1
0
class TestNodeRunner(unittest.TestCase):

    def __init__(self, *args, **kwargs):
        super(TestNodeRunner, self).__init__(*args, **kwargs)
        self.runner = NodeRunner()

    def test_execute_without_args(self):
        result = self.runner.execute(inline)
        self.assertEqual(result, 'test')

    def test_execute_with_args(self):
        result = self.runner.execute(inline_with_args, 'test')
        self.assertEqual(result, 'test')

    def test_execute_silent_without_args(self):
        result = self.runner.execute_silent(inline)
        self.assertTrue(result)

    def test_execute_silent_with_args(self):
        result = self.runner.execute_silent(inline_with_args, 'test')
        self.assertTrue(result)

    def test_execute_script_without_args(self):
        result = self.runner.execute_script(test_script)
        self.assertEqual(result, 'Hello, world!')

    def test_execute_script_with_args(self):
        result = self.runner.execute_script(test_script, 'test')
        self.assertEqual(result, 'test')

    def test_execute_script_silent_without_args(self):
        result = self.runner.execute_script_silent(test_script)
        self.assertTrue(result)

    def test_execute_script_silent_with_args(self):
        result = self.runner.execute_script_silent(test_script, 'test')
        self.assertTrue(result)
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     super(TestNodeRunner, self).__init__(*args, **kwargs)
     self.runner = NodeRunner()