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
97a49208
Commit
97a49208
authored
Aug 07, 2015
by
Ghislain MARY
Browse files
Fix some Python unit test code regarding changes that have been done for the proxy configs.
parent
37166415
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/python/unittests/linphonetester.py
View file @
97a49208
...
...
@@ -105,15 +105,14 @@ class AccountManager:
def
check_account
(
self
,
cfg
):
create_account
=
False
lc
=
cfg
.
core
identity
=
cfg
.
identity
id_addr
=
linphone
.
Address
.
new
(
identity
)
id_addr
=
cfg
.
identity_address
account
=
self
.
_get_account
(
id_addr
)
if
account
is
None
:
linphonetester_logger
.
info
(
"[TESTER] No account for {identity} exists, going to create one."
.
format
(
identity
=
id
entity
))
linphonetester_logger
.
info
(
"[TESTER] No account for {identity} exists, going to create one."
.
format
(
identity
=
id
_addr
.
as_string
()
))
account
=
Account
(
id_addr
,
self
.
unique_id
)
self
.
accounts
.
append
(
account
)
create_account
=
True
cfg
.
identity
=
account
.
modified_identity
.
as_string
()
cfg
.
identity
_address
=
account
.
modified_identity
if
create_account
:
self
.
_create_account_on_server
(
account
,
cfg
)
ai
=
linphone
.
AuthInfo
.
new
(
account
.
modified_identity
.
username
,
None
,
account
.
password
,
None
,
None
,
account
.
modified_identity
.
domain
)
...
...
@@ -136,7 +135,7 @@ class AccountManager:
cfg
=
lc
.
create_proxy_config
()
tmp_identity
.
password
=
account
.
password
tmp_identity
.
set_header
(
"X-Create-Account"
,
"yes"
)
cfg
.
identity
=
tmp_identity
.
as_string
()
cfg
.
identity
_address
=
tmp_identity
server_addr
=
linphone
.
Address
.
new
(
refcfg
.
server_addr
)
server_addr
.
transport
=
linphone
.
TransportType
.
Tcp
;
server_addr
.
port
=
0
...
...
@@ -144,15 +143,15 @@ class AccountManager:
cfg
.
expires
=
3600
lc
.
add_proxy_config
(
cfg
)
if
AccountManager
.
wait_for_until
(
lc
,
None
,
lambda
lc
:
lc
.
user_data
().
auth_requested
==
True
,
10000
)
!=
True
:
linphonetester_logger
.
critical
(
"[TESTER] Account for {identity} could not be created on server."
.
format
(
identity
=
refcfg
.
identity
))
linphonetester_logger
.
critical
(
"[TESTER] Account for {identity} could not be created on server."
.
format
(
identity
=
refcfg
.
identity
_address
.
as_string
()
))
sys
.
exit
(
-
1
)
cfg
.
edit
()
cfg
.
identity
=
account
.
modified_identity
.
as_string
()
cfg
.
identity
=
account
.
modified_identity
cfg
.
done
()
ai
=
linphone
.
AuthInfo
.
new
(
account
.
modified_identity
.
username
,
None
,
account
.
password
,
None
,
None
,
account
.
modified_identity
.
domain
)
lc
.
add_auth_info
(
ai
)
if
AccountManager
.
wait_for_until
(
lc
,
None
,
lambda
lc
:
lc
.
user_data
().
created
==
True
,
3000
)
!=
True
:
linphonetester_logger
.
critical
(
"[TESTER] Account for {identity} is not working on server."
.
format
(
identity
=
refcfg
.
identity
))
linphonetester_logger
.
critical
(
"[TESTER] Account for {identity} is not working on server."
.
format
(
identity
=
refcfg
.
identity
_address
.
as_string
()
))
sys
.
exit
(
-
1
)
lc
.
remove_proxy_config
(
cfg
)
if
AccountManager
.
wait_for_until
(
lc
,
None
,
lambda
lc
:
lc
.
user_data
().
done
==
True
,
3000
)
!=
True
:
...
...
@@ -392,7 +391,7 @@ class CoreManager:
def
registration_state_changed
(
cls
,
lc
,
cfg
,
state
,
message
):
manager
=
lc
.
user_data
()
linphonetester_logger
.
info
(
"[TESTER] New registration state {state} for user id [{identity}] at proxy [{addr}]"
.
format
(
state
=
linphone
.
RegistrationState
.
string
(
state
),
identity
=
cfg
.
identity
,
addr
=
cfg
.
server_addr
))
state
=
linphone
.
RegistrationState
.
string
(
state
),
identity
=
cfg
.
identity
_address
.
as_string
()
,
addr
=
cfg
.
server_addr
))
if
state
==
linphone
.
RegistrationState
.
None
:
manager
.
stats
.
number_of_LinphoneRegistrationNone
+=
1
elif
state
==
linphone
.
RegistrationState
.
Progress
:
...
...
@@ -598,8 +597,7 @@ class CoreManager:
self
.
enable_audio_codec
(
"PCMU"
,
8000
)
if
self
.
lc
.
default_proxy_config
is
not
None
:
self
.
identity
=
linphone
.
Address
.
new
(
self
.
lc
.
default_proxy_config
.
identity
)
self
.
identity
.
clean
()
self
.
lc
.
default_proxy_config
.
identity_address
.
clean
()
def
enable_audio_codec
(
self
,
mime
,
rate
):
codecs
=
self
.
lc
.
audio_codecs
...
...
tools/python/unittests/test_register.py
View file @
97a49208
...
...
@@ -24,7 +24,7 @@ class RegisterCoreManager(CoreManager):
self
.
lc
.
sip_transports
=
transport
proxy_cfg
=
self
.
lc
.
create_proxy_config
()
from_address
=
create_address
(
domain
)
proxy_cfg
.
identity
=
from_address
.
as_string
()
proxy_cfg
.
identity
_address
=
from_address
server_addr
=
from_address
.
domain
proxy_cfg
.
register_enabled
=
True
proxy_cfg
.
expires
=
1
...
...
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