new_wukong/tests/core/test_echo.py
2024-05-15 20:33:56 +08:00

13 lines
375 B
Python

import unittest
from src.core import echo
from io import StringIO
import sys
class TestEcho(unittest.TestCase):
def test_base(self):
echoMid = echo.EchoMiddleWare()
captured_out = StringIO()
sys.stdout = captured_out
echoMid.process('hello')
sys.stdout = sys.__stdout__
self.assertEqual(captured_out.getvalue(), 'hello\n')