Exemple #1
0
    def testDeviceLocationInvalid(self, deviceType, device):
        assert device.deviceId in deviceType.devices

        locationBefore = device.getLocation()
        assert locationBefore is None

        try:
            device.setLocation(DeviceLocation(latitude=100, longitude=120))
        except ApiException as e:
            assert e.id == "CUDHT0300I"
            assert len(e.violations) == 1
    def testDeviceLocationInvalid(self, deviceType, device):
        assert_true(device.deviceId in deviceType.devices)

        locationBefore = device.getLocation()
        assert_equals(None, locationBefore)

        try:
            device.setLocation(DeviceLocation(latitude=100, longitude=120))
        except ApiException as e:
            assert_equals("CUDRS0007E", e.id)
            assert_true(len(e.violations) == 1)
    def testDeviceLocationInvalid(self, deviceType, device):
        assert device.deviceId in deviceType.devices

        locationBefore = device.getLocation()
        assert locationBefore is None
           
        try:
            device.setLocation(DeviceLocation(latitude=100, longitude=120))
        except ApiException as e:
            assert e.id == "CUDRS0007E"
            assert len(e.violations) == 1
Exemple #4
0
    def testDeviceLocationGetAndUpdate(self, deviceType, device):
        assert device.deviceId in deviceType.devices

        locationBefore = device.getLocation()
        assert locationBefore is None

        device.setLocation({"latitude": 50, "longitude": 60})
        locationAfter = device.getLocation()

        assert locationAfter.updatedDateTime is not None
        assert locationAfter.measuredDateTime is not None

        assert isinstance(locationAfter.updatedDateTime, datetime)
        assert isinstance(locationAfter.measuredDateTime, datetime)

        assert locationAfter.latitude == 50
        assert locationAfter.longitude == 60

        device.setLocation(DeviceLocation(latitude=80, longitude=75))
        locationAfter = device.getLocation()
        assert locationAfter.latitude == 80
        assert locationAfter.longitude == 75
    def testDeviceLocationGetAndUpdate(self, deviceType, device):
        assert_true(device.deviceId in deviceType.devices)

        locationBefore = device.getLocation()
        assert_equals(None, locationBefore)

        device.setLocation({"latitude": 50, "longitude": 60})
        locationAfter = device.getLocation()

        assert_not_equal(None, locationAfter.updatedDateTime)
        assert_not_equal(None, locationAfter.measuredDateTime)

        assert_true(isinstance(locationAfter.updatedDateTime, datetime))
        assert_true(isinstance(locationAfter.measuredDateTime, datetime))

        assert_equals(50, locationAfter.latitude)
        assert_equals(60, locationAfter.longitude)

        device.setLocation(DeviceLocation(latitude=80, longitude=75))
        locationAfter = device.getLocation()
        assert_equals(80, locationAfter.latitude)
        assert_equals(75, locationAfter.longitude)
    def testDeviceLocationGetAndUpdate(self, deviceType, device):   
        assert device.deviceId in deviceType.devices

        locationBefore = device.getLocation()
        assert locationBefore is None
           
        device.setLocation({"latitude": 50, "longitude": 60})
        locationAfter = device.getLocation()        
        
        assert locationAfter.updatedDateTime is not None
        assert locationAfter.measuredDateTime is not None
        
        assert isinstance(locationAfter.updatedDateTime, datetime)
        assert isinstance(locationAfter.measuredDateTime, datetime)
        
        assert locationAfter.latitude == 50
        assert locationAfter.longitude == 60

        device.setLocation(DeviceLocation(latitude=80, longitude=75))
        locationAfter = device.getLocation()        
        assert locationAfter.latitude == 80
        assert locationAfter.longitude == 75