aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/__init__.py1
-rw-r--r--tests/commons.py32
-rw-r--r--tests/fixture/__init__.py0
-rw-r--r--tests/fixture/dummyPluginDisabled.py31
-rw-r--r--tests/fixture/dummyPluginEnabled.py32
-rw-r--r--tests/testbasic.py59
-rw-r--r--tests/testldap.py41
7 files changed, 0 insertions, 196 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index 8b137891..00000000
--- a/tests/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tests/commons.py b/tests/commons.py
deleted file mode 100644
index de2906fd..00000000
--- a/tests/commons.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# commons.py
-import sys, os
-
-commons = {}
-commons['bin'] = '/usr/sbin/sosreport'
-commons['fnameRe'] = '/tmp/sosreport-*.xz'
-commons['testName'] = 'tester'
-commons['testID'] = 1
-commons['batch'] = True
-commons['i18n'] = 'en_US.UTF-8'
-commons['pluginpath'] = None
-commons['plugins'] = []
-commons['testOptions'] = ['--build','--batch']
-if os.path.isfile('/etc/fedora-release'):
- commons['distro'] = 'Fedora'
-else:
- commons['distro'] = 'RHEL'
-
-paths = sys.path
-for path in paths:
- if path.strip()[-len("site-packages"):] == "site-packages" \
- and os.path.isdir(path + "/sos/plugins"):
- commons['pluginpath'] = path + "/sos/plugins"
-
-for plugin in os.listdir(commons['pluginpath']):
- plugbase = plugin[:-3]
- if not plugin[-3:] == '.py' or plugbase == "__init__":
- continue
- commons['plugins'].append(plugbase)
-
-def desc(txt):
- sys.stdout.write(txt)
diff --git a/tests/fixture/__init__.py b/tests/fixture/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/tests/fixture/__init__.py
+++ /dev/null
diff --git a/tests/fixture/dummyPluginDisabled.py b/tests/fixture/dummyPluginDisabled.py
deleted file mode 100644
index c86e7b44..00000000
--- a/tests/fixture/dummyPluginDisabled.py
+++ /dev/null
@@ -1,31 +0,0 @@
-### This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-import sos.plugintools
-import os
-
-class dummyPluginDisabled(sos.plugintools.PluginBase):
- """ dummy test plugin """
-
- def defaultenabled(self):
- return False
-
- def setup(self):
- filename = "/tmp/testenabled.file"
- f = open(filename,'w')
- f.close()
- self.addCopySpec(filename)
- return
-
-
diff --git a/tests/fixture/dummyPluginEnabled.py b/tests/fixture/dummyPluginEnabled.py
deleted file mode 100644
index 9074ae6b..00000000
--- a/tests/fixture/dummyPluginEnabled.py
+++ /dev/null
@@ -1,32 +0,0 @@
-### This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-import sos.plugintools
-import os
-
-class dummyPluginEnabled(sos.plugintools.PluginBase):
- """ dummy test plugin """
-
- def defaultenabled(self):
- return True
-
- def setup(self):
- filename = "/tmp/testenabled.file"
- f = open(filename,'w')
- f.close()
- self.addCopySpec(filename)
- return
-
-
-
diff --git a/tests/testbasic.py b/tests/testbasic.py
deleted file mode 100644
index 231481ae..00000000
--- a/tests/testbasic.py
+++ /dev/null
@@ -1,59 +0,0 @@
-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
diff --git a/tests/testldap.py b/tests/testldap.py
deleted file mode 100644
index 19511f74..00000000
--- a/tests/testldap.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from sos.sosreport import *
-from commons import *
-from nose.tools import *
-import os, sys, shutil
-
-class GlobalVars:
- pass
-
-class TestLDAP:
- def __init__(self):
- GlobalVars.commons = commons
- GlobalVars.dstroot = None
-
- 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 testPostProc(self):
- """ check scraping of bindpw if exists """
- GlobalVars.commons['testOptions'].append("-oldap")
- GlobalVars.dstroot = sosreport(GlobalVars.commons['testOptions'])
- ldapconf = os.path.join(GlobalVars.dstroot,'etc/ldap.conf')
- if os.path.isfile(ldapconf) and os.path.isfile("/etc/ldap.conf"):
- f = open('/etc/ldap.conf','r').readlines()
- for line in f:
- assert_false('bindpw ***' in line)
-
- def testCapture(self):
- """ check for capture of proper files """
- GlobalVars.commons['testOptions'].append("-oldap")
- GlobalVars.dstroot = sosreport(GlobalVars.commons['testOptions'])
- ldapdir = os.path.join(GlobalVars.dstroot,'etc/openldap')
- if os.path.isdir(ldapdir) and \
- os.path.isfile(os.path.join(GlobalVars.dstroot,'etc/ldap.conf')):
- GlobalVars.commons['testOptions'].pop()
- assert_true