aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-27 23:33:41 +0000
committerpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-27 23:33:41 +0000
commitc4d03d9b99ee4f8c464b46c90101510681bc5c0e (patch)
treecf186689cd61a16bc943491dc80d1d4f481676e9 /tests
parent6d8b15f796fc9a90ac1be8275d3fc118b6bc8d61 (diff)
downloadsos-c4d03d9b99ee4f8c464b46c90101510681bc5c0e.tar.gz
[tests] Replaced old expect scripts with pexpect
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@1048 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'tests')
-rw-r--r--tests/sosreport_pexpect.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/sosreport_pexpect.py b/tests/sosreport_pexpect.py
new file mode 100644
index 00000000..164fa9c8
--- /dev/null
+++ b/tests/sosreport_pexpect.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import unittest
+import pexpect
+
+from re import search, escape
+from os import kill
+from signal import SIGINT
+
+class PexpectTest(unittest.TestCase):
+ def test_plugins_install(self):
+ sos = pexpect.spawn('/usr/sbin/sosreport -l')
+ try:
+ sos.expect('plugin.*does not install, skipping')
+ except pexpect.EOF:
+ pass
+ else:
+ self.fail("a plugin does not install or sosreport is too slow")
+ kill(sos.pid, SIGINT)
+
+ def test_batchmode_removes_questions(self):
+ sos = pexpect.spawn('/usr/sbin/sosreport --batch')
+ grp = sos.expect('send this file to your support representative.', 15)
+ self.assertEquals(grp, 0)
+ kill(sos.pid, SIGINT)
+
+if __name__ == '__main__':
+ unittest.main()