コード例 #1
0
ファイル: times.py プロジェクト: yombo/yombo-gateway
 def setUp(self):
     setupLoader()
     self._loader = getLoader()
     self._loader.importLibraries()
     self.times = getTimes()
     self.times.init(self._loader,PatchEnvironment=True)
     self.messages = getComponent('yombo.gateway.lib.messages')
     self.messages.init(self._loader)
コード例 #2
0
ファイル: devices.py プロジェクト: yombo/yombo-gateway
    def testDeviceGetMessage(self):
        """
        Validates device.get_message().
        """
        record = {
            "description": "Test device 2.",
            "created": int(time.time()) - 9,
            "updated": int(time.time()),
            "device_id": "01zZzZzZzZzZzZzZzZzZzZ03",
            "device_type_id": "zZzZzZzZzZzZzZzZzZzZzZ03",
            "pin_required": 1,
            "pin_timeout": 100,
            "pin_code": "1234",
            "label": "tstdvc3",
            "status": 1,  # device enabled or not, not device status
            "module_label": "ModuleUnitTest",
            "voice_cmd": "tstdvc01 [on, off, open, close]",
            "voice_cmdorder": "verbnoun",
        }

        dev = self._Devices._addDevice(record, True)  # create dummy device
        with self.expectRaises(Yombopin_codeError):  # Pin is required, so, it should toss an error
            dev.get_message("yombo.gateway.tests.devices")

        with self.expectRaises(DeviceError):  # no cmd, cmdUUID, or cmdobj submitted.
            dev.get_message("yombo.gateway.tests.devices", pin_code="1234")

        command = {
            "description": "Test command 3.",
            #                  'created'        : int(time.time())-10,
            #                  'updated'        : int(time.time()),
            "liveupdate": 0,
            "cmduuid": "yYyYyYyYyYyYyYyYyYyYyY03",
            "cmd": "testcmd3",
            "label": "Test Cmd 3",
            "inputtypeid": 1,
            "voice_cmd": "test command 3",
        }

        _Commands = getComponent("yombo.gateway.lib.commands")
        _Commands._addCommand(command, True)

        dev.availableCommands = ["yYyYyYyYyYyYyYyYyYyYyY03"]  # force this command to work with device

        tempObj = mock.Mock()
        tempObj._FullName = "yombo.gateway.tests.devices"
        dev.get_message(tempObj, pin_code="1234", cmd="Test Cmd 3")
コード例 #3
0
ファイル: crontab.py プロジェクト: yombo/yombo-gateway
 def setUp(self):
     self._CronTab = getComponent("yombo.gateway.lib.crontab")
コード例 #4
0
ファイル: devices.py プロジェクト: yombo/yombo-gateway
 def setUp(self):
     self._Devices = getComponent("yombo.gateway.lib.devices")
コード例 #5
0
ファイル: commands.py プロジェクト: yombo/yombo-gateway
 def setUp(self):
     self._Commands = getComponent("yombo.gateway.lib.commands")
コード例 #6
0
ファイル: z-times.py プロジェクト: yombo/yombo-gateway
pyximport.install()
from yombo.lib.loader import setupLoader, getLoader


setupLoader()
_loader = getLoader()
_loader.importLibraries()
from yombo.core.helpers import getTimes, getComponent

print "**********************************************************************************************************************************************************************************"
print "**************************************HERE WE STARTING TESTS -- ALL ERRORS ABOVE(about reactor) DO NOT MATTER*********************************************************************"
times = getTimes()
times.init(_loader, PatchEnvironment=True)

messages = getComponent("yombo.gateway.lib.messages")
messages.init(_loader)

times.run_inner_tests()
moonrise = times.objRise(1, "Moon")  # 1 - we want the next moon rise
print moonrise


import os
from twisted.application import service, internet
from twisted.web import static, server


def getWebService():
    """
    Return a service suitable for creating an application object.