def test_config(self): device = self.create(activate=True) comp = iotkitclient.Component(device) comp.add_component(componentName, componentType) device.save_config("foo.json", True) info = device.load_config("foo.json") #iotkitclient.prettyprint(info) for key, value in info.items(): #print "%s = %s = %s" % (key, str(value), str(getattr(device, key))) self.assertEqual(value, getattr(device, key)) pass
def test_deleteComponent(self): device = self.create(activate=True) comp = iotkitclient.Component(device) comp.add_component(componentName, componentType) self.assertTrue(comp.id) comp.delete_component(comp.id)
device.get_device(device_id) except: device_info = { "deviceId": device_id, "gatewayId": device_id, "name": "Device #1" } device.create_device(device_info) act_code = acct.renew_activation_code() device.activate_new_device(act_code) device.save_config("device.json", True) device.load_config("device.json") print "Using Device: %s ..." % device_id comp = iotkitclient.Component(device) try: comp.get_component(config.component_name) #comp.delete_component(comp.id) except: comp.add_component(config.component_name, config.component_type) print "Using Component: %s (%s) ..." % (config.component_name, comp.id) data = [(int(time.time() * 1000 - 500), "65.3"), (int(time.time() * 1000 - 400), "57.5"), (int(time.time() * 1000 - 300), "61.4"), (int(time.time() * 1000 - 200), "59.2"), (int(time.time() * 1000 - 100), "66.5"), (int(time.time() * 1000), "65.3")] dataseries = device.package_data_series(data, comp.id)