Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
X
xivo-dao
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xivo.solutions
xivo-dao
Commits
d634e126
Commit
d634e126
authored
Apr 02, 2020
by
Tomas Taraba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3162 Edit tests
parent
738c1fbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
xivo_dao/resources/func_key/tests/test_hint_dao.py
xivo_dao/resources/func_key/tests/test_hint_dao.py
+26
-21
No files found.
xivo_dao/resources/func_key/tests/test_hint_dao.py
View file @
d634e126
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment