Ejemplo n.º 1
0
#
# Shinken 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.

#
# This file is used to test reading and processing of config files
#

from shinken_test import *
from shinken.modulesctx import modulesctx
modulesctx.set_modulesdir(modules_dir)
webui = modulesctx.get_module('webui')
helper = webui.helper


class TestUIHelper(ShinkenTest):
    def setUp(self):
        self.setup_with_file('etc/shinken_1r_1h_1s.cfg')

    def test_duration_print(self):
        now = time.time()

        # Got bogus return
        s = helper.print_duration(None)
        print "Res", s
        self.assert_(s == 'N/A')
import unittest

from shinken.modulesctx import modulesctx
from shinken.objects.module import Module
from shinken_test import ShinkenTest
from pprint import pprint
from shinken.log import logger
import logging

if os.getenv("TEST_DEBUG") == "1" or True:
    logger.setLevel(logging.DEBUG)

sys.setcheckinterval(10000)

path = ".."
modulesctx.set_modulesdir(path)

livestatus_broker = modulesctx.get_module('module')
LiveStatus_broker = livestatus_broker.LiveStatus_broker
LiveStatus = livestatus_broker.LiveStatus


class LivestatusTestBase(ShinkenTest):

    cfg_file = 'etc/shinken_5r_10h_200s.cfg'

    def init_livestatus(self):
        modconf = Module({
            'module_name': 'LiveStatus2',
            'module_type': 'livestatus2',
            'port': str(50000 + os.getpid()),