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
a5288b94
Commit
a5288b94
authored
Dec 16, 2014
by
Ghislain MARY
Browse files
Fix Python module tests.
parent
f16696d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
tools/python/unittests/linphonetester.py
View file @
a5288b94
...
...
@@ -89,9 +89,9 @@ class AccountManager:
@
classmethod
def
account_created_on_server_cb
(
cls
,
lc
,
cfg
,
state
,
message
):
if
state
==
linphone
.
RegistrationState
.
Registration
Ok
:
if
state
==
linphone
.
RegistrationState
.
Ok
:
lc
.
user_data
.
created
=
True
elif
state
==
linphone
.
RegistrationState
.
Registration
Cleared
:
elif
state
==
linphone
.
RegistrationState
.
Cleared
:
lc
.
user_data
.
done
=
True
@
classmethod
...
...
@@ -134,7 +134,7 @@ class AccountManager:
tmp_identity
.
set_header
(
"X-Create-Account"
,
"yes"
)
cfg
.
identity
=
tmp_identity
.
as_string
()
server_addr
=
linphone
.
Address
.
new
(
refcfg
.
server_addr
)
server_addr
.
transport
=
linphone
.
TransportType
.
Transport
Tcp
;
server_addr
.
transport
=
linphone
.
TransportType
.
Tcp
;
server_addr
.
port
=
0
cfg
.
server_addr
=
server_addr
.
as_string
()
cfg
.
expires
=
3600
...
...
@@ -365,12 +365,12 @@ class CoreManager:
lambda
callee_manager
,
caller_manager
:
(
callee_manager
.
stats
.
number_of_LinphoneCallStreamsRunning
==
initial_callee_stats
.
number_of_LinphoneCallStreamsRunning
+
1
)
and
\
(
caller_manager
.
stats
.
number_of_LinphoneCallStreamsRunning
==
initial_caller_stats
.
number_of_LinphoneCallStreamsRunning
+
1
))
if
caller_manager
.
lc
.
media_encryption
!=
linphone
.
MediaEncryption
.
MediaEncryptionNone
and
callee_manager
.
lc
.
media_encryption
!=
linphone
.
MediaEncryption
.
MediaEncryption
None
:
if
caller_manager
.
lc
.
media_encryption
!=
linphone
.
MediaEncryption
.
MediaEncryptionNone
and
callee_manager
.
lc
.
media_encryption
!=
linphone
.
MediaEncryption
.
None
:
# Wait for encryption to be on, in case of zrtp, it can take a few seconds
if
caller_manager
.
lc
.
media_encryption
==
linphone
.
MediaEncryption
.
MediaEncryption
ZRTP
:
if
caller_manager
.
lc
.
media_encryption
==
linphone
.
MediaEncryption
.
ZRTP
:
CoreManager
.
wait_for
(
callee_manager
,
caller_manager
,
lambda
callee_manager
,
caller_manager
:
caller_manager
.
stats
.
number_of_LinphoneCallEncryptedOn
==
initial_caller_stats
.
number_of_LinphoneCallEncryptedOn
+
1
)
if
callee_manager
.
lc
.
media_encryption
==
linphone
.
MediaEncryption
.
MediaEncryption
ZRTP
:
if
callee_manager
.
lc
.
media_encryption
==
linphone
.
MediaEncryption
.
ZRTP
:
CoreManager
.
wait_for
(
callee_manager
,
caller_manager
,
lambda
callee_manager
,
caller_manager
:
callee_manager
.
stats
.
number_of_LinphoneCallEncryptedOn
==
initial_callee_stats
.
number_of_LinphoneCallEncryptedOn
+
1
)
assert_equals
(
callee_manager
.
lc
.
current_call
.
current_params
.
media_encryption
,
caller_manager
.
lc
.
media_encryption
)
...
...
@@ -389,15 +389,15 @@ class CoreManager:
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
))
if
state
==
linphone
.
RegistrationState
.
Registration
None
:
if
state
==
linphone
.
RegistrationState
.
None
:
manager
.
stats
.
number_of_LinphoneRegistrationNone
+=
1
elif
state
==
linphone
.
RegistrationState
.
Registration
Progress
:
elif
state
==
linphone
.
RegistrationState
.
Progress
:
manager
.
stats
.
number_of_LinphoneRegistrationProgress
+=
1
elif
state
==
linphone
.
RegistrationState
.
Registration
Ok
:
elif
state
==
linphone
.
RegistrationState
.
Ok
:
manager
.
stats
.
number_of_LinphoneRegistrationOk
+=
1
elif
state
==
linphone
.
RegistrationState
.
Registration
Cleared
:
elif
state
==
linphone
.
RegistrationState
.
Cleared
:
manager
.
stats
.
number_of_LinphoneRegistrationCleared
+=
1
elif
state
==
linphone
.
RegistrationState
.
Registration
Failed
:
elif
state
==
linphone
.
RegistrationState
.
Failed
:
manager
.
stats
.
number_of_LinphoneRegistrationFailed
+=
1
else
:
raise
Exception
(
"Unexpected registration state"
)
...
...
@@ -415,45 +415,45 @@ class CoreManager:
to_address
=
call
.
call_log
.
to_address
.
as_string
()
from_address
=
call
.
call_log
.
from_address
.
as_string
()
direction
=
"Outgoing"
if
call
.
call_log
.
dir
==
linphone
.
CallDir
.
Call
Incoming
:
if
call
.
call_log
.
dir
==
linphone
.
CallDir
.
Incoming
:
direction
=
"Incoming"
linphonetester_logger
.
info
(
"[TESTER] {direction} call from [{from_address}] to [{to_address}], new state is [{state}]"
.
format
(
direction
=
direction
,
from_address
=
from_address
,
to_address
=
to_address
,
state
=
linphone
.
CallState
.
string
(
state
)))
if
state
==
linphone
.
CallState
.
Call
IncomingReceived
:
if
state
==
linphone
.
CallState
.
IncomingReceived
:
manager
.
stats
.
number_of_LinphoneCallIncomingReceived
+=
1
elif
state
==
linphone
.
CallState
.
Call
OutgoingInit
:
elif
state
==
linphone
.
CallState
.
OutgoingInit
:
manager
.
stats
.
number_of_LinphoneCallOutgoingInit
+=
1
elif
state
==
linphone
.
CallState
.
Call
OutgoingProgress
:
elif
state
==
linphone
.
CallState
.
OutgoingProgress
:
manager
.
stats
.
number_of_LinphoneCallOutgoingProgress
+=
1
elif
state
==
linphone
.
CallState
.
Call
OutgoingRinging
:
elif
state
==
linphone
.
CallState
.
OutgoingRinging
:
manager
.
stats
.
number_of_LinphoneCallOutgoingRinging
+=
1
elif
state
==
linphone
.
CallState
.
Call
OutgoingEarlyMedia
:
elif
state
==
linphone
.
CallState
.
OutgoingEarlyMedia
:
manager
.
stats
.
number_of_LinphoneCallOutgoingEarlyMedia
+=
1
elif
state
==
linphone
.
CallState
.
Call
Connected
:
elif
state
==
linphone
.
CallState
.
Connected
:
manager
.
stats
.
number_of_LinphoneCallConnected
+=
1
elif
state
==
linphone
.
CallState
.
Call
StreamsRunning
:
elif
state
==
linphone
.
CallState
.
StreamsRunning
:
manager
.
stats
.
number_of_LinphoneCallStreamsRunning
+=
1
elif
state
==
linphone
.
CallState
.
Call
Pausing
:
elif
state
==
linphone
.
CallState
.
Pausing
:
manager
.
stats
.
number_of_LinphoneCallPausing
+=
1
elif
state
==
linphone
.
CallState
.
Call
Paused
:
elif
state
==
linphone
.
CallState
.
Paused
:
manager
.
stats
.
number_of_LinphoneCallPaused
+=
1
elif
state
==
linphone
.
CallState
.
Call
Resuming
:
elif
state
==
linphone
.
CallState
.
Resuming
:
manager
.
stats
.
number_of_LinphoneCallResuming
+=
1
elif
state
==
linphone
.
CallState
.
Call
Refered
:
elif
state
==
linphone
.
CallState
.
Refered
:
manager
.
stats
.
number_of_LinphoneCallRefered
+=
1
elif
state
==
linphone
.
CallState
.
Call
Error
:
elif
state
==
linphone
.
CallState
.
Error
:
manager
.
stats
.
number_of_LinphoneCallError
+=
1
elif
state
==
linphone
.
CallState
.
Call
End
:
elif
state
==
linphone
.
CallState
.
End
:
manager
.
stats
.
number_of_LinphoneCallEnd
+=
1
elif
state
==
linphone
.
CallState
.
Call
PausedByRemote
:
elif
state
==
linphone
.
CallState
.
PausedByRemote
:
manager
.
stats
.
number_of_LinphoneCallPausedByRemote
+=
1
elif
state
==
linphone
.
CallState
.
Call
UpdatedByRemote
:
elif
state
==
linphone
.
CallState
.
UpdatedByRemote
:
manager
.
stats
.
number_of_LinphoneCallUpdatedByRemote
+=
1
elif
state
==
linphone
.
CallState
.
Call
IncomingEarlyMedia
:
elif
state
==
linphone
.
CallState
.
IncomingEarlyMedia
:
manager
.
stats
.
number_of_LinphoneCallIncomingEarlyMedia
+=
1
elif
state
==
linphone
.
CallState
.
Call
Updating
:
elif
state
==
linphone
.
CallState
.
Updating
:
manager
.
stats
.
number_of_LinphoneCallUpdating
+=
1
elif
state
==
linphone
.
CallState
.
Call
Released
:
elif
state
==
linphone
.
CallState
.
Released
:
manager
.
stats
.
number_of_LinphoneCallReleased
+=
1
else
:
raise
Exception
(
"Unexpected call state"
)
...
...
@@ -489,63 +489,63 @@ class CoreManager:
manager
.
stats
.
number_of_NotifyReceived
+=
1
manager
.
stats
.
last_received_presence
=
lf
.
presence_model
acttype
=
manager
.
stats
.
last_received_presence
.
activity
.
type
if
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Offline
:
if
acttype
==
linphone
.
PresenceActivityType
.
Offline
:
manager
.
stats
.
number_of_LinphonePresenceActivityOffline
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Online
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Online
:
manager
.
stats
.
number_of_LinphonePresenceActivityOnline
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Appointment
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Appointment
:
manager
.
stats
.
number_of_LinphonePresenceActivityAppointment
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Away
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Away
:
manager
.
stats
.
number_of_LinphonePresenceActivityAway
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Breakfast
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Breakfast
:
manager
.
stats
.
number_of_LinphonePresenceActivityBreakfast
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Busy
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Busy
:
manager
.
stats
.
number_of_LinphonePresenceActivityBusy
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Dinner
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Dinner
:
manager
.
stats
.
number_of_LinphonePresenceActivityDinner
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Holiday
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Holiday
:
manager
.
stats
.
number_of_LinphonePresenceActivityHoliday
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
InTransit
:
elif
acttype
==
linphone
.
PresenceActivityType
.
InTransit
:
manager
.
stats
.
number_of_LinphonePresenceActivityInTransit
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
LookingForWork
:
elif
acttype
==
linphone
.
PresenceActivityType
.
LookingForWork
:
manager
.
stats
.
number_of_LinphonePresenceActivityLookingForWork
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Lunch
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Lunch
:
manager
.
stats
.
number_of_LinphonePresenceActivityLunch
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Meal
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Meal
:
manager
.
stats
.
number_of_LinphonePresenceActivityMeal
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Meeting
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Meeting
:
manager
.
stats
.
number_of_LinphonePresenceActivityMeeting
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
OnThePhone
:
elif
acttype
==
linphone
.
PresenceActivityType
.
OnThePhone
:
manager
.
stats
.
number_of_LinphonePresenceActivityOnThePhone
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Other
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Other
:
manager
.
stats
.
number_of_LinphonePresenceActivityOther
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Performance
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Performance
:
manager
.
stats
.
number_of_LinphonePresenceActivityPerformance
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
PermanentAbsence
:
elif
acttype
==
linphone
.
PresenceActivityType
.
PermanentAbsence
:
manager
.
stats
.
number_of_LinphonePresenceActivityPermanentAbsence
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Playing
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Playing
:
manager
.
stats
.
number_of_LinphonePresenceActivityPlaying
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Presentation
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Presentation
:
manager
.
stats
.
number_of_LinphonePresenceActivityPresentation
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Shopping
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Shopping
:
manager
.
stats
.
number_of_LinphonePresenceActivityShopping
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Sleeping
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Sleeping
:
manager
.
stats
.
number_of_LinphonePresenceActivitySleeping
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Spectator
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Spectator
:
manager
.
stats
.
number_of_LinphonePresenceActivitySpectator
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Steering
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Steering
:
manager
.
stats
.
number_of_LinphonePresenceActivitySteering
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Travel
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Travel
:
manager
.
stats
.
number_of_LinphonePresenceActivityTravel
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
TV
:
elif
acttype
==
linphone
.
PresenceActivityType
.
TV
:
manager
.
stats
.
number_of_LinphonePresenceActivityTV
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Unknown
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Unknown
:
manager
.
stats
.
number_of_LinphonePresenceActivityUnknown
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Vacation
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Vacation
:
manager
.
stats
.
number_of_LinphonePresenceActivityVacation
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Working
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Working
:
manager
.
stats
.
number_of_LinphonePresenceActivityWorking
+=
1
elif
acttype
==
linphone
.
PresenceActivityType
.
PresenceActivity
Worship
:
elif
acttype
==
linphone
.
PresenceActivityType
.
Worship
:
manager
.
stats
.
number_of_LinphonePresenceActivityWorship
+=
1
def
__init__
(
self
,
rc_file
=
None
,
check_for_proxies
=
True
,
vtable
=
{}):
...
...
tools/python/unittests/test_call.py
View file @
a5288b94
...
...
@@ -17,11 +17,11 @@ class TestCall:
assert_equals
(
CoreManager
.
wait_for_until
(
pauline
,
marie
,
lambda
pauline
,
marie
:
pauline
.
stats
.
number_of_LinphoneCallError
==
1
,
33000
),
True
)
assert_equals
(
pauline
.
stats
.
number_of_LinphoneCallError
,
1
)
#FIXME http://git.linphone.org/mantis/view.php?id=757
#assert_equals(out_call.reason, linphone.Reason.
Reason
Busy)
#assert_equals(out_call.reason, linphone.Reason.Busy)
if
len
(
pauline
.
lc
.
call_logs
)
>
0
:
out_call_log
=
pauline
.
lc
.
call_logs
[
0
]
assert
out_call_log
is
not
None
assert_equals
(
out_call_log
.
status
,
linphone
.
CallStatus
.
Call
Aborted
)
assert_equals
(
out_call_log
.
status
,
linphone
.
CallStatus
.
Aborted
)
marie
.
stop
()
pauline
.
stop
()
...
...
@@ -38,8 +38,8 @@ class TestCall:
assert_equals
(
CoreManager
.
wait_for
(
pauline
,
marie
,
lambda
pauline
,
marie
:
pauline
.
stats
.
number_of_LinphoneCallReleased
==
1
),
True
)
assert_equals
(
marie
.
stats
.
number_of_LinphoneCallEnd
,
1
)
assert_equals
(
pauline
.
stats
.
number_of_LinphoneCallEnd
,
1
)
assert_equals
(
in_call
.
reason
,
linphone
.
Reason
.
Reason
Declined
)
assert_equals
(
out_call
.
reason
,
linphone
.
Reason
.
Reason
Declined
)
assert_equals
(
in_call
.
reason
,
linphone
.
Reason
.
Declined
)
assert_equals
(
out_call
.
reason
,
linphone
.
Reason
.
Declined
)
marie
.
stop
()
pauline
.
stop
()
...
...
@@ -97,7 +97,7 @@ class TestCall:
# flexisip will retain the 488 until the "urgent reply" timeout arrives.
assert_equals
(
CoreManager
.
wait_for_until
(
pauline
,
marie
,
lambda
pauline
,
marie
:
pauline
.
stats
.
number_of_LinphoneCallError
==
1
,
7000
),
True
)
assert_equals
(
out_call
.
reason
,
linphone
.
Reason
.
Reason
NotAcceptable
)
assert_equals
(
out_call
.
reason
,
linphone
.
Reason
.
NotAcceptable
)
assert_equals
(
marie
.
stats
.
number_of_LinphoneCallIncomingReceived
,
0
)
assert_equals
(
marie
.
stats
.
number_of_LinphoneCallReleased
,
0
)
marie
.
stop
()
...
...
tools/python/unittests/test_message.py
View file @
a5288b94
...
...
@@ -14,13 +14,13 @@ class TestMessage:
def
msg_state_changed
(
cls
,
msg
,
state
):
stats
=
msg
.
chat_room
.
core
.
user_data
.
stats
linphonetester_logger
.
info
(
"[TESTER] Message [{text}] [{state}]"
.
format
(
text
=
msg
.
text
,
state
=
linphone
.
ChatMessageState
.
string
(
state
)))
if
state
==
linphone
.
ChatMessageState
.
ChatMessageState
Delivered
:
if
state
==
linphone
.
ChatMessageState
.
Delivered
:
stats
.
number_of_LinphoneMessageDelivered
+=
1
elif
state
==
linphone
.
ChatMessageState
.
ChatMessageState
NotDelivered
:
elif
state
==
linphone
.
ChatMessageState
.
NotDelivered
:
stats
.
number_of_LinphoneMessageNotDelivered
+=
1
elif
state
==
linphone
.
ChatMessageState
.
ChatMessageState
InProgress
:
elif
state
==
linphone
.
ChatMessageState
.
InProgress
:
stats
.
number_of_LinphoneMessageInProgress
+=
1
elif
state
==
linphone
.
ChatMessageState
.
ChatMessageState
FileTransferError
:
elif
state
==
linphone
.
ChatMessageState
.
FileTransferError
:
stats
.
number_of_LinphoneMessageNotDelivered
+=
1
else
:
linphonetester_logger
.
error
(
"[TESTER] Unexpected state [{state}] for message [{msg}]"
.
format
(
msg
=
msg
,
state
=
linphone
.
ChatMessageState
.
string
(
state
)))
...
...
@@ -95,7 +95,7 @@ class TestMessage:
chat_room
=
pauline
.
lc
.
get_chat_room
(
marie
.
identity
)
self
.
wait_for_server_to_purge_messages
(
marie
,
pauline
)
msg
=
chat_room
.
create_message
(
"Bla bla bla bla"
)
chat_room
.
send_message
2
(
msg
,
None
,
None
)
chat_room
.
send_
chat_
message
(
msg
)
assert_equals
(
CoreManager
.
wait_for
(
pauline
,
marie
,
lambda
pauline
,
marie
:
marie
.
stats
.
number_of_LinphoneMessageReceived
==
1
),
True
)
assert
marie
.
lc
.
get_chat_room
(
pauline
.
identity
)
is
not
None
marie
.
stop
()
...
...
@@ -109,7 +109,7 @@ class TestMessage:
self
.
wait_for_server_to_purge_messages
(
marie
,
pauline
)
assert_equals
(
CoreManager
.
call
(
marie
,
pauline
),
True
)
msg
=
chat_room
.
create_message
(
"Bla bla bla bla"
)
chat_room
.
send_message
2
(
msg
,
None
,
None
)
chat_room
.
send_
chat_
message
(
msg
)
assert_equals
(
CoreManager
.
wait_for
(
pauline
,
marie
,
lambda
pauline
,
marie
:
marie
.
stats
.
number_of_LinphoneMessageReceived
==
1
),
True
)
assert
marie
.
lc
.
get_chat_room
(
pauline
.
identity
)
is
not
None
marie
.
stop
()
...
...
tools/python/unittests/test_register.py
View file @
a5288b94
...
...
@@ -18,7 +18,7 @@ class RegisterCoreManager(CoreManager):
vtable
[
'auth_info_requested'
]
=
RegisterCoreManager
.
auth_info_requested
CoreManager
.
__init__
(
self
,
vtable
=
vtable
)
def
register_with_refresh
(
self
,
refresh
,
domain
,
route
,
late_auth_info
=
False
,
expected_final_state
=
linphone
.
RegistrationState
.
Registration
Ok
):
def
register_with_refresh
(
self
,
refresh
,
domain
,
route
,
late_auth_info
=
False
,
expected_final_state
=
linphone
.
RegistrationState
.
Ok
):
assert
self
.
lc
is
not
None
self
.
stats
.
reset
()
proxy_cfg
=
self
.
lc
.
create_proxy_config
()
...
...
@@ -42,25 +42,25 @@ class RegisterCoreManager(CoreManager):
if
refresh
:
expected_count
+=
1
max_retry
=
110
if
expected_final_state
==
linphone
.
RegistrationState
.
Registration
Progress
:
if
expected_final_state
==
linphone
.
RegistrationState
.
Progress
:
max_retry
+=
200
while
self
.
stats
.
number_of_LinphoneRegistrationOk
<
expected_count
and
retry
<
max_retry
:
retry
+=
1
self
.
lc
.
iterate
()
if
self
.
stats
.
number_of_auth_info_requested
>
0
and
proxy_cfg
.
state
==
linphone
.
RegistrationState
.
Registration
Failed
and
late_auth_info
:
if
self
.
stats
.
number_of_auth_info_requested
>
0
and
proxy_cfg
.
state
==
linphone
.
RegistrationState
.
Failed
and
late_auth_info
:
if
len
(
self
.
lc
.
auth_info_list
)
==
0
:
assert_equals
(
proxy_cfg
.
error
,
linphone
.
Reason
.
Reason
Unauthorized
)
assert_equals
(
proxy_cfg
.
error
,
linphone
.
Reason
.
Unauthorized
)
info
=
linphone
.
AuthInfo
.
new
(
test_username
,
None
,
test_password
,
None
,
None
,
None
)
# Create authentication structure from identity
self
.
lc
.
add_auth_info
(
info
)
if
proxy_cfg
.
error
==
linphone
.
Reason
.
Reason
Forbidden
or
\
(
self
.
stats
.
number_of_auth_info_requested
>
2
and
proxy_cfg
.
error
==
linphone
.
Reason
.
Reason
Unauthorized
):
if
proxy_cfg
.
error
==
linphone
.
Reason
.
Forbidden
or
\
(
self
.
stats
.
number_of_auth_info_requested
>
2
and
proxy_cfg
.
error
==
linphone
.
Reason
.
Unauthorized
):
break
time
.
sleep
(
0.1
)
assert_equals
(
proxy_cfg
.
state
,
expected_final_state
)
assert_equals
(
self
.
stats
.
number_of_LinphoneRegistrationNone
,
0
)
assert
self
.
stats
.
number_of_LinphoneRegistrationProgress
>=
1
if
expected_final_state
==
linphone
.
RegistrationState
.
Registration
Ok
:
if
expected_final_state
==
linphone
.
RegistrationState
.
Ok
:
assert_equals
(
self
.
stats
.
number_of_LinphoneRegistrationOk
,
expected_count
)
expected_failed
=
0
if
late_auth_info
:
...
...
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