Commit 8091b04a authored by Etienne Allovon's avatar Etienne Allovon

Merge branch '3392-update-label' into 'master'

3392 add update labels APi

See merge request !68
parents c7b6f71d bfaddad1
xivo-dao (2020.14.00) xivo-freya; urgency=medium
[Tomas Taraba]
* 3438 Disassociate users from label when the label is deleted
[Rim Jamali]
* 3392 update labels API
-- Tomas Taraba <[email protected]> Tue, 04 Aug 2020 16:14:32 +0200
xivo-dao (2020.13.00) xivo-freya; urgency=medium
......
......@@ -48,6 +48,12 @@ def create(label):
return label
def edit(label):
Session.add(label)
Session.flush()
return label
def delete(label):
label = get(label.id)
_disassociate(label)
......
......@@ -38,6 +38,8 @@ class TestLabelExist(DAOTestCase):
assert_that(result, equal_to(True))
class TestLabelCRUD(DAOTestCase):
def test_get_all_labels(self):
self.add_user(callerid='"John Doe"')
......@@ -105,3 +107,13 @@ class TestLabelExist(DAOTestCase):
assert_that(result_label, equal_to(expected_label))
assert_that(result_user.id, equal_to(user.id))
assert_that(len(result_user.labels), equal_to(0))
def test_edit_label(self):
label = self.add_label()
label.display_name = 'MyLabel'
label.description = 'Any Label'
label_dao.edit(label)
result = label_dao.get(label.id)
assert_that(result, equal_to(label))
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