def test_getthings_order_by(self): # Height does not support sorting, hence weight typeid = '3d34d87e-7fc1-4153-800f-f56592cb0d17' weight_filter = ThingFilter() weight_format = ThingFormat() weight_format.sections.append('core') weight_format.sections.append('xml') weight_filter.typeids.append(typeid) order_by = ThingOrderBySpecs(typeid, 'When') order_by.direction = 'Desc' group = ThingGroup() group.filters = [weight_filter] group.format = weight_format group.order_by = order_by method = GetThings([group]) method.execute(self.connection) self.assertEqual(len(method.response.groups), 1) if method.response.groups[0].healthrecorditems: items = method.response.groups[0].healthrecorditems self.assertEqual(typeid, items[0].type_id) self.assertIsNotNone(items[0].value_kg) self.assertTrue(items[0].when > items[1].when)