Commit f305f7d7 authored by Francois Blackburn's avatar Francois Blackburn

outcall: add order_by to trunks relationship

parent 346fff2b
......@@ -53,6 +53,7 @@ class Outcall(Base):
trunks = relationship('TrunkFeatures',
secondary='outcalltrunk',
order_by='OutcallTrunk.priority',
back_populates='outcalls')
@hybrid_property
......
......@@ -67,14 +67,14 @@ class TestGet(DAOTestCase):
trunk1_row = self.add_trunk()
trunk2_row = self.add_trunk()
trunk3_row = self.add_trunk()
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk1_row.id, priority=0)
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk2_row.id, priority=1)
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk3_row.id, priority=2)
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk1_row.id, priority=2)
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk2_row.id, priority=0)
self.add_outcall_trunk(outcall_id=outcall_row.id, trunk_id=trunk3_row.id, priority=1)
outcall = outcall_dao.get(outcall_row.id)
assert_that(outcall, equal_to(outcall_row))
assert_that(outcall.trunks, contains(trunk1_row, trunk2_row, trunk3_row))
assert_that(outcall.trunks, contains(trunk2_row, trunk3_row, trunk1_row))
class TestFindBy(DAOTestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment