order traits returned within events
- we order the traits by key in all the backends except sql. this keeps sql inline. - this reverts a patch to sort traits post query in test. Change-Id: I17009bdb01106dc07659a9198da2090ec63bcf51 Closes-Bug: #1423714
This commit is contained in:
parent
534048d96c
commit
4c4734c448
@ -313,7 +313,8 @@ class Connection(base.Connection):
|
|||||||
.add_columns(models.TraitText.key, sa.null(),
|
.add_columns(models.TraitText.key, sa.null(),
|
||||||
sa.null(), sa.null(), models.TraitText.value))
|
sa.null(), sa.null(), models.TraitText.value))
|
||||||
|
|
||||||
for id_, key, t_date, t_int, t_float, t_text in trait_q.all():
|
for id_, key, t_date, t_int, t_float, t_text in (
|
||||||
|
trait_q.order_by('2')).all():
|
||||||
if t_int:
|
if t_int:
|
||||||
dtype = api_models.Trait.INT_TYPE
|
dtype = api_models.Trait.INT_TYPE
|
||||||
val = t_int
|
val = t_int
|
||||||
|
@ -3229,8 +3229,7 @@ class GetEventTest(EventTestBase):
|
|||||||
self.assertEqual(event.generated,
|
self.assertEqual(event.generated,
|
||||||
self.event_models[i].generated)
|
self.event_models[i].generated)
|
||||||
model_traits = self.event_models[i].traits
|
model_traits = self.event_models[i].traits
|
||||||
for j, trait in enumerate(sorted(event.traits,
|
for j, trait in enumerate(event.traits):
|
||||||
key=operator.attrgetter("name"))):
|
|
||||||
if trait.dtype == event_models.Trait.DATETIME_TYPE:
|
if trait.dtype == event_models.Trait.DATETIME_TYPE:
|
||||||
self.assertIsInstance(trait.value, datetime.datetime)
|
self.assertIsInstance(trait.value, datetime.datetime)
|
||||||
self.assertEqual(trait.value, model_traits[j].value)
|
self.assertEqual(trait.value, model_traits[j].value)
|
||||||
|
Loading…
Reference in New Issue
Block a user