Merge "order traits returned within events"

This commit is contained in:
Jenkins 2015-03-12 16:08:31 +00:00 committed by Gerrit Code Review
commit 0ffffd69e0
2 changed files with 3 additions and 3 deletions

View File

@ -318,7 +318,8 @@ class Connection(base.Connection):
.add_columns(models.TraitText.key, sa.null(),
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:
dtype = api_models.Trait.INT_TYPE
val = t_int

View File

@ -3229,8 +3229,7 @@ class GetEventTest(EventTestBase):
self.assertEqual(event.generated,
self.event_models[i].generated)
model_traits = self.event_models[i].traits
for j, trait in enumerate(sorted(event.traits,
key=operator.attrgetter("name"))):
for j, trait in enumerate(event.traits):
if trait.dtype == event_models.Trait.DATETIME_TYPE:
self.assertIsInstance(trait.value, datetime.datetime)
self.assertEqual(trait.value, model_traits[j].value)