Commit 5b580e11 authored by Jean-Yves LEBLEU's avatar Jean-Yves LEBLEU Committed by Pascal Cadotte-Michaud

added enable disable recording for a user

parent 829d6871
......@@ -2,6 +2,8 @@ XiVO data access object
Dependencies:
-------------
needs mock version >= 1.0
lib-python (xivo-skaro)
sqlalchemy >= 0.6.3
postgresql
......
......@@ -128,6 +128,39 @@ class TestUserFeaturesDAO(DAOTestCase):
user_id = user_features.id
return user_id
def test_enable_recording(self):
user_id = self._insert_user_recording_disabled()
user_dao.enable_recording(user_id)
self._check_recording(user_id, 1)
def test_disable_recording(self):
user_id = self._insert_user_recording_enabled()
user_dao.disable_recording(user_id)
self._check_recording(user_id, 0)
def _check_recording(self, user_id, value):
user_features = (self.session.query(UserFeatures)
.filter(UserFeatures.id == user_id))[0]
self.assertEquals(user_features.callrecord, value)
def _insert_user_recording_disabled(self):
user_features = UserFeatures()
user_features.callrecord = 0
user_features.firstname = 'firstname_recording not set'
self.add_me(user_features)
user_id = user_features.id
return user_id
def _insert_user_recording_enabled(self):
user_features = UserFeatures()
user_features.callrecord = 1
user_features.firstname = 'firstname_recording set'
self.add_me(user_features)
user_id = user_features.id
return user_id
def _check_filter_in_db(self, user_id, value):
user_features = (self.session.query(UserFeatures)
.filter(UserFeatures.id == user_id))[0]
......
......@@ -65,6 +65,14 @@ def disable_busy_fwd(user_id, destination):
update(user_id, {'enablebusy': 0, 'destbusy': destination})
def enable_recording(user_id):
update(user_id, {'callrecord': 1})
def disable_recording(user_id):
update(user_id, {'callrecord': 0})
@daosession
def update(session, user_id, user_data_dict):
session.begin()
......
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