Commit d634e126 authored by Tomas Taraba's avatar Tomas Taraba

3162 Edit tests

parent 738c1fbb
......@@ -23,7 +23,7 @@ from xivo_dao.alchemy.callfiltermember import Callfiltermember
from xivo_dao.resources.func_key.tests.test_helpers import FuncKeyHelper
from xivo_dao.resources.func_key import hint_dao
from xivo_dao.resources.func_key.model import Hint
from xivo_dao.resources.func_key.model import Hint, HintWithOptions
class TestProgfunckeyExtension(DAOTestCase):
......@@ -59,7 +59,8 @@ class TestHints(DAOTestCase, FuncKeyHelper):
self.setup_funckeys()
self.context = 'mycontext'
def add_user_and_func_key(self, protocol='sip', protocol_id=None, exten='1000', commented=0, enablehint=1, configregistrar='default'):
def add_user_and_func_key(self, protocol='sip', protocol_id=None, exten='1000', commented=0, enablehint=1,
configregistrar='default'):
if not protocol_id:
protocol_id = self.add_usersip().id
user_row = self.add_user_line_extension(protocol, protocol_id, exten, commented, enablehint, configregistrar)
......@@ -67,8 +68,8 @@ class TestHints(DAOTestCase, FuncKeyHelper):
return user_row
def add_user_line_extension(self, protocol, protocol_id, exten, commented=0, enablehint=1, configregistrar='default'):
def add_user_line_extension(self, protocol, protocol_id, exten, commented=0, enablehint=1,
configregistrar='default'):
user_row = self.add_user(enablehint=enablehint)
line_row = self.add_line(context=self.context,
protocol=protocol,
......@@ -91,10 +92,11 @@ class TestUserHints(TestHints):
usersip_row = self.add_usersip(name='abcdef')
user_row = self.add_user_and_func_key('sip', usersip_row.id)
expected = Hint(user_id=user_row.id,
extension='1000',
argument='SIP/abcdef',
mediaserver='default')
expected = HintWithOptions(user_id=user_row.id,
extension='1000',
argument='SIP/abcdef',
mediaserver='default',
options=[])
assert_that(hint_dao.user_hints(self.context), contains(expected))
......@@ -103,10 +105,11 @@ class TestUserHints(TestHints):
usersip_row = self.add_usersip(name='abcdef')
user_row = self.add_user_and_func_key('sip', usersip_row.id, 1000, 0, 1, 'mds1')
expected = Hint(user_id=user_row.id,
extension='1000',
argument='SIP/abcdef',
mediaserver='mds1')
expected = HintWithOptions(user_id=user_row.id,
extension='1000',
argument='SIP/abcdef',
mediaserver='mds1',
options=[])
assert_that(hint_dao.user_hints(self.context), contains(expected))
......@@ -114,10 +117,11 @@ class TestUserHints(TestHints):
sccpline_row = self.add_sccpline(name='1001', context=self.context)
user_row = self.add_user_and_func_key('sccp', sccpline_row.id, '1001')
expected = Hint(user_id=user_row.id,
extension='1001',
argument='SCCP/1001',
mediaserver='default')
expected = HintWithOptions(user_id=user_row.id,
extension='1001',
argument='SCCP/1001',
mediaserver='default',
options=None)
assert_that(hint_dao.user_hints(self.context), contains(expected))
......@@ -125,10 +129,11 @@ class TestUserHints(TestHints):
custom_row = self.add_usercustom(interface='ghijkl', context=self.context)
user_row = self.add_user_and_func_key('custom', custom_row.id, '1002')
expected = Hint(user_id=user_row.id,
extension='1002',
argument='ghijkl',
mediaserver='default')
expected = HintWithOptions(user_id=user_row.id,
extension='1002',
argument='ghijkl',
mediaserver='default',
options=None)
assert_that(hint_dao.user_hints(self.context), contains(expected))
......@@ -432,7 +437,7 @@ class TestBSFilterHints(TestHints):
def create_boss_and_secretary(self, commented=0, mediaserver='default'):
if mediaserver != 'default':
self.add_mediaserver(name=mediaserver, display_name='MDS1', voip_ip='10.10.0.1')
boss_row = self.add_user_and_func_key(exten='1000', configregistrar=mediaserver)
secretary_row = self.add_user_and_func_key(exten='1001', configregistrar=mediaserver)
......
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