Commit 2b191546 authored by Jean Aunis's avatar Jean Aunis

added method get_by_voicemailid in user_dao

parent 778fec7c
......@@ -862,3 +862,27 @@ class TestUserFeaturesDAO(DAOTestCase):
assert_that(result, contains_inanyorder(user1_id, user2_id))
assert_that(result[user1_id]['firstname'], equal_to(user1.firstname))
assert_that(result[user2_id]['firstname'], equal_to(user2.firstname))
def test_get_by_voicemailid(self):
user1 = UserFeatures(
firstname='John',
lastname='Jackson',
voicemailid=1
)
user2 = UserFeatures(
firstname='Jack',
lastname='Johnson',
voicemailid=1
)
user3 = UserFeatures(
firstname='Christopher',
lastname='Christopherson',
voicemailid=2
)
self.add_me(user1)
self.add_me(user2)
self.add_me(user3)
result = user_dao.get_by_voicemailid(1)
self.assertTrue(user1 in result)
self.assertTrue(user2 in result)
self.assertFalse(user3 in result)
......@@ -276,6 +276,11 @@ def get_users_config(session):
return dict((str(user.id), _format_user(user)) for user in users)
@daosession
def get_by_voicemailid(session, voicemailid):
return session.query(UserFeatures).filter(UserFeatures.voicemailid == voicemailid).all()
def _user_config_query(session):
return session.query(
UserFeatures.agentid,
......
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