Ejemplo n.º 1
0
    
        for idx, val in enumerate(params['xpl']):
            params['xpl'][idx]['value'] = DEVICE_NAME
    
        # go and create
        td.create_device(params)
        print "Device UPS {0} configured".format(DEVICE_NAME) 
    except:
        print(u"Error while creating the test devices : {0}".format(traceback.format_exc()))
        sys.exit(1)

    ### prepare and run the test suite
    suite = unittest.TestSuite()
    # check domogik is running, configure the plugin
    suite.addTest(NUTServeTestCase("test_0001_domogik_is_running", xpl_plugin, name, cfg))
    suite.addTest(NUTServeTestCase("test_0010_configure_the_plugin", xpl_plugin, name, cfg))

    # start the plugin
    suite.addTest(NUTServeTestCase("test_0050_start_the_plugin", xpl_plugin, name, cfg))

    # do the specific plugin tests
    suite.addTest(NUTServeTestCase("test_0110_send_test_battery", xpl_plugin, name, cfg))

   # do some tests comon to all the plugins
    suite.addTest(NUTServeTestCase("test_9900_hbeat", xpl_plugin, name, cfg))
    suite.addTest(NUTServeTestCase("test_9990_stop_the_plugin", xpl_plugin, name, cfg))
    unittest.TextTestRunner().run(suite)

    # quit
    xpl_plugin.force_leave()
Ejemplo n.º 2
0
        self.skipTest("Not implemented")

    def test_670_add_bad_alarm(self):
        self.skipTest("Not implemented")

    def test_710_add_alarm(self):
        self.skipTest("Not implemented")

    def test_770_add_bad_alarm(self):
        self.skipTest("Not implemented")

    def test_910_halt_testjob1(self):
        self.assertTrue(self.cronquery.halt_job("testjob1"))

    def test_920_halt_testjob2(self):
        self.assertTrue(self.cronquery.halt_job("testjob2"))


if __name__ == "__main__":

    count_files = 0

    sendplugin = XplPlugin(name="cronqt", daemonize=False, parser=None, nohub=True)

    # unittest.main()
    suite = unittest.TestLoader().loadTestsFromTestCase(QueryTestCase)
    # suite.addTests(unittest.TestLoader().loadTestsFromTestCase(IntervalTestCase))
    unittest.TextTestRunner(verbosity=3).run(suite)

    sendplugin.force_leave()
Ejemplo n.º 3
0
    suite.addTest(GeolocTestCase("test_0001_domogik_is_running", xpl_plugin, name, cfg))
    suite.addTest(GeolocTestCase("test_0010_configure_the_plugin", xpl_plugin, name, cfg))
    
    # start the plugin
    suite.addTest(GeolocTestCase("test_0050_start_the_plugin", xpl_plugin, name, cfg))

    # do the specific plugin tests
    suite.addTest(GeolocTestCase("test_0100_position", xpl_plugin, name, cfg))
    
    # wait for 2 seconds... why ? well... this is quite embarrasing to explain!
    # on my laptop, when the "stop the plugin" test is launched, an "active" 
    # plugin.status message is sent just before the "stopped" plugin.status 
    # message... and so, the plugin is seen as still active and the test fails
    # yeah, this need to be fixed in the testplugin.py file, but this will be 
    # done later so...
    time.sleep(2)

    # do some tests comon to all the plugins
    #suite.addTest(GeolocTestCase("test_9900_hbeat", xpl_plugin, name, cfg))
    suite.addTest(GeolocTestCase("test_9990_stop_the_plugin", xpl_plugin, name, cfg))
    
    # quit
    res = unittest.TextTestRunner().run(suite)
    if res.wasSuccessful() == True:
        rc = 0   # tests are ok so the shell return code is 0
    else:
        rc = 1   # tests are ok so the shell return code is != 0
    xpl_plugin.force_leave(return_code = rc)
     
    
Ejemplo n.º 4
0
    def test_670_add_bad_alarm(self):
        self.skipTest("Not implemented")

    def test_710_add_alarm(self):
        self.skipTest("Not implemented")

    def test_770_add_bad_alarm(self):
        self.skipTest("Not implemented")

    def test_910_halt_testjob1(self):
        self.assertTrue(self.cronquery.halt_job("testjob1"))

    def test_920_halt_testjob2(self):
        self.assertTrue(self.cronquery.halt_job("testjob2"))


if __name__ == '__main__':

    count_files = 0

    sendplugin = XplPlugin(name = 'cronqt', daemonize = False, \
            parser = None, nohub = True)

    #unittest.main()
    suite = unittest.TestLoader().loadTestsFromTestCase(QueryTestCase)
    #suite.addTests(unittest.TestLoader().loadTestsFromTestCase(IntervalTestCase))
    unittest.TextTestRunner(verbosity=3).run(suite)

    sendplugin.force_leave()
Ejemplo n.º 5
0
    except:
        print(u"Error while creating the test devices : {0}".format(
            traceback.format_exc()))
        sys.exit(1)

    ### prepare and run the test suite
    suite = unittest.TestSuite()
    # check domogik is running, configure the plugin
    suite.addTest(
        IRTransTestCase("test_0001_domogik_is_running", xpl_plugin, name, cfg))
    suite.addTest(
        IRTransTestCase("test_0010_configure_the_plugin", xpl_plugin, name,
                        cfg))

    # start the plugin
    suite.addTest(
        IRTransTestCase("test_0050_start_the_plugin", xpl_plugin, name, cfg))

    # do the specific plugin tests
    suite.addTest(
        IRTransTestCase("test_0110_send_code_standard", xpl_plugin, name, cfg))

    # do some tests comon to all the plugins
    suite.addTest(IRTransTestCase("test_9900_hbeat", xpl_plugin, name, cfg))
    suite.addTest(
        IRTransTestCase("test_9990_stop_the_plugin", xpl_plugin, name, cfg))
    unittest.TextTestRunner().run(suite)

    # quit
    xpl_plugin.force_leave()
    except:
        print(u"Error while creating the test devices : {0}".format(traceback.format_exc()))
        sys.exit(1)

    
    ### prepare and run the test suite
    suite = unittest.TestSuite()
    # check domogik is running, configure the plugin
    suite.addTest(RfxcomTestCase("test_0001_domogik_is_running", xpl_plugin, name, cfg))
    suite.addTest(RfxcomTestCase("test_0010_configure_the_plugin", xpl_plugin, name, cfg))
    
    # start the plugin
    suite.addTest(RfxcomTestCase("test_0050_start_the_plugin", xpl_plugin, name, cfg))

    # do the specific plugin tests
    suite.addTest(RfxcomTestCase("test_0100_type52_temperature_and_humidity_sensor", xpl_plugin, name, cfg))

    # do some tests comon to all the plugins
    #suite.addTest(RfxcomTestCase("test_9900_hbeat", xpl_plugin, name, cfg))
    suite.addTest(RfxcomTestCase("test_9990_stop_the_plugin", xpl_plugin, name, cfg))
    
    # quit
    res = unittest.TextTestRunner().run(suite)
    if res.wasSuccessful() == True:
        rc = 0   # tests are ok so the shell return code is 0
    else:
        rc = 1   # tests are ok so the shell return code is != 0
    xpl_plugin.force_leave(return_code = rc)


Ejemplo n.º 7
0
        if response is not None:
            response = response.get_data()
            if 'result' in response:
                print(u"{0} : The new device is: {1}".format(
                    datetime.now(), response['result']))
                device_id = response['result']
            else:
                print("Error when creating the device : {0} : {1}".format(
                    params, response))
        else:
            print("Error when creating the device : {0}".format(params))

    except:
        print(u"Error while creating the test devices : {0}".format(
            traceback.format_exc()))
        plugin.force_leave(return_code=1)
        sys.exit(1)
    ### prepare and run the test suite
    suite = unittest.TestSuite()
    # check domogik is running, configure the plugin
    suite.addTest(
        ZwaveCtrlTestCase("test_0001_domogik_is_running", plugin, name, cfg))
    suite.addTest(
        ZwaveCtrlTestCase("test_0010_configure_the_plugin", plugin, name, cfg))

    # start the plugin
    suite.addTest(
        ZwaveCtrlTestCase("test_0050_start_the_plugin", plugin, name, cfg))

    # do the specific plugin tests
    # test zwave ctrl start step