Commit 67ca4d50 authored by Laurent Meiller's avatar Laurent Meiller Committed by Tomas Taraba

3389 Add create dao action

parent a8d74a61
......@@ -34,6 +34,10 @@ def get(label_id):
query = Session.query(Labels).filter_by(id=label_id)
return query.first()
def create(label):
return label
def delete(label):
......@@ -20,6 +20,7 @@ from import SearchResult
from xivo_dao.tests.test_dao import DAOTestCase
from xivo_dao.resources.labels import dao as label_dao
from xivo_dao.resources.user import dao as user_dao
from xivo_dao.alchemy.labels import Labels
class TestLabelExist(DAOTestCase):
......@@ -47,6 +48,15 @@ class TestLabelExist(DAOTestCase):
assert_that(result[1][0].users_count, equal_to(0))
assert_that(result, equal_to(expected))
def test_create_label(self):
props = {
'display_name': 'MyLabel',
'description': 'Any Label'
label = label_dao.create(Labels(**props))
expected = label_dao.get(
assert_that(label, equal_to(expected))
def test_get_all_labels_with_associated_user(self):
label_row = self.add_label()
user = self.add_user(callerid='"John Doe"')
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