aboutsummaryrefslogtreecommitdiff
path: root/tests/test_imagoIO.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_imagoIO.py')
-rw-r--r--tests/test_imagoIO.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_imagoIO.py b/tests/test_imagoIO.py
new file mode 100644
index 0000000..c3c6fda
--- /dev/null
+++ b/tests/test_imagoIO.py
@@ -0,0 +1,40 @@
+"""Tests for the input/output component."""
+
+import unittest
+
+import io
+import sys
+
+from imago.engine.imagoIO import ImagoIO
+
+class TestImagoIO(unittest.TestCase):
+ """Test ImagoIO component."""
+
+ @unittest.mock.patch('imago.engine.imagoIO.input', create=True)
+
+ def testSimpleCommands(self, mocked_input):
+ """Test simple commands."""
+
+ mocked_input.side_effect = [
+ 'name\n',
+ 'version\n',
+ 'protocol_version\n',
+ 'quit\n'
+ ]
+
+ testout = io.StringIO()
+ imagoIO = ImagoIO(outputStream=testout)
+
+ imagoIO.start()
+ value = testout.getvalue()
+ self.assertEqual(
+ '= Imago\n\n' +
+ '= 0.0.0\n\n' +
+ '= 2\n\n',
+ value
+ )
+
+ testout.close()
+
+if __name__ == '__main__':
+ unittest.main()