def create_device():
    ### create the device, and if ok, get its id in device_id
    print(u"Creating the vigilocation device...")
    td = TestDevice()
    td.create_device("plugin", plugin, get_sanitized_hostname(), "test_vigilocation", "vigilightning.vigilocation")
    td.configure_global_parameters({"latitude " : "46.739868", "longitude" : "2.328084",
                "criticalradius" : 1, "nearbyradius" : 3, "approachradius" : 5,
                "releasetimes" : 3})
    print "Device vigilocation configured"
Пример #2
0
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_IRTrans_Lan", "irtrans.irtrans_lan")
        params = {"device" : DEVICE_NAME, "server_path" : DEVICE_PATH, "ip_server": DEVICE_IP_SERVER, "irtrans_ip": DEVICE_IP_IRTRANS}
        print (u"configure_global_parameters : {0}".format(params))
        td.configure_global_parameters(params)
    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))
Пример #3
0
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_IRTrans_Lan",
                                     "irtrans.irtrans_lan")
        params = {
            "device": DEVICE_NAME,
            "server_path": DEVICE_PATH,
            "ip_server": DEVICE_IP_SERVER,
            "irtrans_ip": DEVICE_IP_IRTRANS
        }
        print(u"configure_global_parameters : {0}".format(params))
        td.configure_global_parameters(params)
    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
    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create the test devices
    for dev in devices:
        try:
            device_id = td.create_device(client_id, "test_device_rfxcom_type52_{0}".format(dev), "rfxcom.temperature_humidity")
            td.configure_global_parameters({"device" : dev})
            devices[dev] = device_id
        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
#!/usr/bin/python
# -*- coding: utf-8 -*-


from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname


if __name__ == "__main__":

    td = TestDevice()
    td.create_device("plugin", "rfxcom", get_sanitized_hostname(), "test_device_rfxcom", "rfxcom.temperature_humidity")
    td.configure_global_parameters({"address" : "th1 0x2504"})