"""Unit test for the SamplingServer $Id: test.py 1401 2009-05-04 08:56:17Z goodwin $ """ # Copyright 2008-2011 eGovMon # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the eGovernment Monitoring # (eGovMon) # # eGovMon 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. # # eGovMon 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 eGovMon; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA __author__ = "$Author: goodwin $" __version__ = "$Revision: 803 $" __updated__ = "$LastChangedDate: 2009-05-04 08:56:17 +0000 (Mon, 04 May 2009) $" import os import unittest import doctest import SOAPpy import sc sc = sc.SystemConfiguration() class TestSequenceFunctions(unittest.TestCase): def setUp(self): data = os.popen('ps aux | grep samplingserver | grep -v grep').read() if not 'samplingserver' in data: os.system('/etc/init.d/samplingserver start') def testrunning(self): data = os.popen('ps aux | grep samplingserver | grep -v grep').read() self.assert_('samplingserver' in data) def testinstalled(self): data = os.popen('ls -alh /usr/bin/samplingserver').read() self.assert_('samplingserver' in data) def testininit(self): data = os.popen('ls -alh /etc/init.d/samplingserver').read() self.assert_('samplingserver' in data) def testonline(self): self.assert_(SOAPpy.SOAPProxy(sc.samplingserver).ping()) if __name__ == "__main__": unittest.main()