Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
b05b3db1
Commit
b05b3db1
authored
Aug 27, 2014
by
Ghislain MARY
Browse files
Add first Python module unit tests.
parent
294916d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
tools/python/unittests/test_setup.py
tools/python/unittests/test_setup.py
+54
-0
No files found.
tools/python/unittests/test_setup.py
0 → 100644
View file @
b05b3db1
from
nose.tools
import
assert_equals
import
linphone
test_username
=
"liblinphone_tester"
test_route
=
"sip2.linphone.org"
def
create_address
(
domain
):
addr
=
linphone
.
Address
.
new
(
None
)
assert
addr
!=
None
addr
.
username
=
test_username
assert_equals
(
addr
.
username
,
test_username
)
if
domain
is
not
None
:
domain
=
test_route
addr
.
domain
=
domain
assert_equals
(
addr
.
domain
,
domain
)
addr
.
display_name
=
None
addr
.
display_name
=
"Mr Tester"
assert_equals
(
addr
.
display_name
,
"Mr Tester"
)
return
addr
class
TestSetup
:
def
test_address
(
self
):
create_address
(
None
)
def
test_core_init
(
self
):
lc
=
linphone
.
Core
.
new
({},
None
,
None
)
assert
lc
is
not
None
if
lc
is
not
None
:
lc
.
verify_server_certificates
(
False
)
def
test_interpret_url
(
self
):
lc
=
linphone
.
Core
.
new
({},
None
,
None
)
assert
lc
is
not
None
sips_address
=
"sips:margaux@sip.linphone.org"
address
=
lc
.
interpret_url
(
sips_address
)
assert
address
is
not
None
assert_equals
(
address
.
scheme
,
"sips"
)
assert_equals
(
address
.
username
,
"margaux"
)
assert_equals
(
address
.
domain
,
"sip.linphone.org"
)
def
test_lpconfig_from_buffer
(
self
):
buffer
=
"[buffer]
\n
test=ok"
buffer_linebreaks
=
"[buffer_linebreaks]
\n\n\n\r\n\n\r\n
test=ok"
conf
=
linphone
.
LpConfig
.
new_from_buffer
(
buffer
)
assert_equals
(
conf
.
get_string
(
"buffer"
,
"test"
,
""
),
"ok"
)
conf
=
linphone
.
LpConfig
.
new_from_buffer
(
buffer_linebreaks
)
assert_equals
(
conf
.
get_string
(
"buffer_linebreaks"
,
"test"
,
""
),
"ok"
)
def
test_create_chat_room
(
self
):
lc
=
linphone
.
Core
.
new
({},
None
,
None
)
assert
lc
is
not
None
cr
=
lc
.
get_chat_room_from_uri
(
"sip:toto@titi.com"
)
assert
cr
is
not
None
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