Commit 0cc3169e authored by Jean Aunis's avatar Jean Aunis

removed unused method 'delete_all', and added 'delete' in voicemail_dao

parent 2b191546
......@@ -69,13 +69,6 @@ class VoicemailDAOTestCase(DAOTestCase):
result = voicemail_dao.all()
self.assertEqual([], result)
def test_delete_all(self):
self._insert_voicemail("123")
self._insert_voicemail("456")
voicemail_dao.delete_all()
result = voicemail_dao.all()
self.assertEqual([], result)
def test_add(self):
voicemail = Voicemail()
voicemail.mailbox = "123"
......@@ -102,3 +95,8 @@ class VoicemailDAOTestCase(DAOTestCase):
def test_id_from_mailbox_unexisting(self):
result = voicemail_dao.id_from_mailbox("123", "default")
self.assertEquals(result, None)
def test_delete(self):
generated_id = self._insert_voicemail("123", "default")
impacted_rows = voicemail_dao.delete(generated_id)
self.assertEquals(impacted_rows, 1)
......@@ -30,17 +30,6 @@ def get(session, voicemail_id):
return session.query(Voicemail).filter(Voicemail.uniqueid == voicemail_id).first()
@daosession
def delete_all(session):
session.begin()
try:
session.query(Voicemail).delete()
session.commit()
except Exception:
session.rollback()
raise
@daosession
def add(session, voicemail):
session.begin()
......@@ -70,3 +59,14 @@ def update(session, voicemailid, data):
except Exception:
session.rollback()
raise
@daosession
def delete(session, uniqueid):
session.begin()
try:
impacted_rows = session.query(Voicemail).filter(Voicemail.uniqueid == uniqueid).delete()
session.commit()
return impacted_rows
except Exception:
session.rollback()
raise
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