aboutsummaryrefslogtreecommitdiffstats
path: root/test/testbasic.py
diff options
context:
space:
mode:
authorastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-02-17 16:28:17 +0000
committerastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-02-17 16:28:17 +0000
commit18191c43943661b2d61b191ea95a9c9351bd465c (patch)
treedd426874c830ec029dbd44eec4e469131d4fadc9 /test/testbasic.py
parent494f1de1db6c29a3f5f6d0e5cabc29b86eaf99e8 (diff)
downloadsos-18191c43943661b2d61b191ea95a9c9351bd465c.tar.gz
- moved 1.9 to trunkr1.9
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@778 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'test/testbasic.py')
-rw-r--r--test/testbasic.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/testbasic.py b/test/testbasic.py
new file mode 100644
index 00000000..231481ae
--- /dev/null
+++ b/test/testbasic.py
@@ -0,0 +1,59 @@
+import os, sys, shutil
+from commons import *
+from nose.tools import *
+from sos.sosreport import *
+from glob import glob
+
+class GlobalVars:
+ pass
+
+class TestBasicSos:
+ def __init__(self):
+ GlobalVars.dstroot = None
+ GlobalVars.commons = commons
+ # clean pre-existing dummy plugins
+ for i in glob(GlobalVars.commons['pluginpath']+'/dummyPlugin*'):
+ os.remove(os.path.join(GlobalVars.commons['pluginpath'],i))
+
+ def setup(self):
+ """ prework """
+ pass
+
+ def teardown(self):
+ """ cleanup dstroot and other miscellaneous files """
+ if os.path.isdir(GlobalVars.dstroot) and not None:
+ shutil.rmtree(GlobalVars.dstroot)
+
+ def testSosreportBin(self):
+ """ test existence of sosreport bin """
+ if not os.path.isfile(GlobalVars.commons['bin']):
+ raise AssertionError("Sosreport executable does not exist")
+
+
+ def testUnattended(self):
+ """ test unattended """
+ GlobalVars.commons['testOptions'].append("-ofilesys")
+ GlobalVars.dstroot = sosreport(GlobalVars.commons['testOptions'])
+ if not os.path.isdir(GlobalVars.dstroot):
+ raise AssertionError("No sosreport created")
+
+ def testPluginEnable(self):
+ """ test success of plugin enable """
+ if os.path.isdir(GlobalVars.commons['pluginpath']):
+ shutil.copy('fixture/dummyPluginEnabled.py',GlobalVars.commons['pluginpath'])
+ GlobalVars.commons['testOptions'].append('-odummyPluginEnabled')
+ GlobalVars.dstroot = sosreport(GlobalVars.commons['testOptions'])
+ if os.path.isdir(GlobalVars.dstroot) \
+ and os.path.isfile(os.path.join(GlobalVars.dstroot,'tmp/testenabled.file')):
+ return True
+ raise AssertionError("testenabled.file not found")
+
+ def testPluginDisable(self):
+ """ test plugin disable """
+ if os.path.isdir(GlobalVars.commons['pluginpath']):
+ shutil.copy('fixture/dummyPluginDisabled.py',GlobalVars.commons['pluginpath'])
+ GlobalVars.dstroot = sosreport(["-nrpm","-nselinux","--batch","--build"])
+ if os.path.isdir(GlobalVars.dstroot) \
+ and os.path.isfile(os.path.join(GlobalVars.dstroot,'tmp/testenabled.file')):
+ raise AssertionError("plugin not disabled")
+ return True