c_utf8
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run Details

This commit is contained in:
emdee@spm.plastiras.org 2024-02-24 14:36:08 +00:00
parent 6e3dd26dad
commit 283d0d2f95
8 changed files with 624 additions and 204 deletions

View File

@ -16,9 +16,11 @@ check::
install:: install::
${PIP_EXE_MSYS} --python ${PYTHON_EXE_MSYS} install \ ${PIP_EXE_MSYS} --python ${PYTHON_EXE_MSYS} install \
--no-deps --no-index --find-links=. \ --no-deps \
--target ${PREFIX}/lib/python${PYTHON_MINOR}/site-packages/ \ --target ${PREFIX}/lib/python${PYTHON_MINOR}/site-packages/ \
--upgrade . --upgrade .
sed -i -e "1s@/usr/bin/python${PYTHON_MINOR}@${PYTHON_EXE_MSYS}@" \
${PREFIX}/lib/python${PYTHON_MINOR}/site-packages/bin/*
rsync:: rsync::
bash .rsync.sh bash .rsync.sh
@ -51,7 +53,8 @@ test_proxy::
--proxy_port=9050 \ --proxy_port=9050 \
--proxy_type=2 \ --proxy_type=2 \
--nodes_json=$$HOME/.config/tox/DHTnodes.json \ --nodes_json=$$HOME/.config/tox/DHTnodes.json \
--trace_enabled=False --loglevel=10 --trace_enabled=False \
--loglevel=10
clean:: clean::
rm -f .[a-z]*~ *~ */*~ */*/*~ rm -f .[a-z]*~ *~ */*~ */*/*~

View File

@ -34,8 +34,7 @@ file = "LICENSE.md"
repository = "https://git.plastiras.org/emdee/toxygen_wrapper" repository = "https://git.plastiras.org/emdee/toxygen_wrapper"
[build-system] [build-system]
# >= 61.0 requires = ["setuptools >= 61.0"]
requires = ["setuptools >= 0"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.setuptools] [tool.setuptools]

View File

@ -23,6 +23,10 @@ python_requires = >=3.6
package_dir= package_dir=
=src =src
packages = ["toxygen_wrapper", "toxygen_wrapper.tests"] packages = ["toxygen_wrapper", "toxygen_wrapper.tests"]
include_package_data =
"*" = ["*.txt"]
install_requires =
coloredlogs
[easy_install] [easy_install]
zip_ok = false zip_ok = false

View File

@ -12,7 +12,7 @@ import socket
import sys import sys
import logging import logging
import time import time
from typing import Union, Callable, Union from typing import Union, Callable, Optional
import warnings import warnings
import stem import stem
@ -308,7 +308,7 @@ def vwait_for_controller(controller, wait_boot:int = 10) -> None:
time.sleep(5) time.sleep(5)
i += 5 i += 5
def bin_to_hex(raw_id:int, length: Union[int, None] = None) -> str: def bin_to_hex(raw_id:int, length: Optional[int] = None) -> str:
if length is None: length = len(raw_id) if length is None: length = len(raw_id)
res = ''.join('{:02x}'.format(raw_id[i]) for i in range(length)) res = ''.join('{:02x}'.format(raw_id[i]) for i in range(length))
return res.upper() return res.upper()

View File

@ -920,7 +920,7 @@ def bootstrap_tcp(lelts:list, lToxes:list, oArgs=None, fsocket_timeout:float = f
LOG.warn(f'bootstrap_tcp failed to {host} : {oRet}') LOG.warn(f'bootstrap_tcp failed to {host} : {oRet}')
elif hasattr(oTox, 'mycon_time') and oTox.mycon_time == 1: elif hasattr(oTox, 'mycon_time') and oTox.mycon_time == 1:
LOG.debug(f'bootstrap_tcp to {host} not yet connected') LOG.debug(f'bootstrap_tcp to {host} not yet connected')
elif hasattr(oTox, 'mycon_status') and oTox.mycon_status is False: elif hasattr(oTox, 'self_conn_status') and oTox.self_conn_status is False:
LOG.debug(f'bootstrap_tcp to {host} not True') LOG.debug(f'bootstrap_tcp to {host} not True')
elif oTox.self_get_connection_status() != enums.TOX_CONNECTION['NONE']: elif oTox.self_get_connection_status() != enums.TOX_CONNECTION['NONE']:
LOG.info(f'bootstrap_tcp to {host} connected') LOG.info(f'bootstrap_tcp to {host} connected')

View File

@ -241,13 +241,13 @@ def prepare(self):
if status != TOX_CONNECTION['NONE']: if status != TOX_CONNECTION['NONE']:
LOG_INFO(f"bobs_on_self_connection_status TRUE {status}" \ LOG_INFO(f"bobs_on_self_connection_status TRUE {status}" \
+f" last={int(self.bob.mycon_time)}" ) +f" last={int(self.bob.mycon_time)}" )
self.bob.mycon_status = True self.bob.self_conn_status = True
else: else:
LOG_DEBUG(f"bobs_on_self_connection_status FALSE {status}" \ LOG_DEBUG(f"bobs_on_self_connection_status FALSE {status}" \
+f" last={int(self.bob.mycon_time)}" ) +f" last={int(self.bob.mycon_time)}" )
self.bob.mycon_status = False self.bob.self_conn_status = False
except Exception as e: except Exception as e:
LOG_ERROR(f"bobs_on_self_connection_status {e}") LOG_ERROR(f"bobs_on_self_connection_status EXCEPTION {e}")
else: else:
if self.bob.self_get_connection_status() != status: if self.bob.self_get_connection_status() != status:
LOG_WARN(f"bobs_on_self_connection_status DISAGREE {status}") LOG_WARN(f"bobs_on_self_connection_status DISAGREE {status}")
@ -261,19 +261,19 @@ def prepare(self):
if status != TOX_CONNECTION['NONE']: if status != TOX_CONNECTION['NONE']:
LOG_INFO(f"alices_on_self_connection_status TRUE {status}" \ LOG_INFO(f"alices_on_self_connection_status TRUE {status}" \
+f" last={int(self.alice.mycon_time)}" ) +f" last={int(self.alice.mycon_time)}" )
self.alice.mycon_status = True self.alice.self_conn_status = True
else: else:
LOG_DEBUG(f"alices_on_self_connection_status FALSE {status}" \ LOG_DEBUG(f"alices_on_self_connection_status FALSE {status}" \
+f" last={int(self.alice.mycon_time)}" ) +f" last={int(self.alice.mycon_time)}" )
self.alice.mycon_status = False self.alice.self_conn_status = False
except Exception as e: except Exception as e:
LOG_ERROR(f"alices_on_self_connection_status error={e}") LOG_ERROR(f"alices_on_self_connection_status EXCEPTION error={e}")
opts = oTestsToxOptions(oTOX_OARGS) opts = oTestsToxOptions(oTOX_OARGS)
alice = AliceTox(opts, oTOX_OARGS, app=oAPP) alice = AliceTox(opts, oTOX_OARGS, app=oAPP)
alice.dht_connected = -1 alice.dht_connected = -1
alice.mycon_status = False alice.self_conn_status = False
alice.mycon_time = 1 alice.mycon_time = 1
alice.callback_self_connection_status(alices_on_self_connection_status) alice.callback_self_connection_status(alices_on_self_connection_status)
@ -286,7 +286,7 @@ def prepare(self):
bob = BobTox(opts, oTOX_OARGS, app=oAPP) bob = BobTox(opts, oTOX_OARGS, app=oAPP)
bob.dht_connected = -1 bob.dht_connected = -1
bob.mycon_status = False bob.self_conn_status = False
bob.mycon_time = 1 bob.mycon_time = 1
bob.callback_self_connection_status(bobs_on_self_connection_status) bob.callback_self_connection_status(bobs_on_self_connection_status)
if not bIS_LOCAL and not ts.bAreWeConnected(): if not bIS_LOCAL and not ts.bAreWeConnected():
@ -301,13 +301,13 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
l = prepare(self) l = prepare(self)
assert l assert l
self.bob, self.alice = l self.bob, self.alice = l
if not hasattr(self.bob, '_main_loop'): if False and not hasattr(self.bob, '_main_loop'):
#? self.bob._main_loop = ToxIterateThread(self.bob) self.bob._main_loop = ToxIterateThread(self.bob)
#? self.bob._main_loop.start() self.bob._main_loop.start()
LOG.debug(f"self.bob._main_loop: ") # {threading.enumerate()} LOG.debug(f"self.bob._main_loop: ") # {threading.enumerate()}
if not hasattr(self.alice, '_main_loop'): if False and not hasattr(self.alice, '_main_loop'):
#? self.alice._main_loop = ToxIterateThread(self.alice) self.alice._main_loop = ToxIterateThread(self.alice)
#? self.alice._main_loop.start() self.alice._main_loop.start()
LOG.debug(f"self.alice._main_loop: ") # {threading.enumerate()} LOG.debug(f"self.alice._main_loop: ") # {threading.enumerate()}
self.bBobNeedAlice() self.bBobNeedAlice()
@ -393,6 +393,54 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
self.assertEqual(cm.output, ['INFO:foo:first message', self.assertEqual(cm.output, ['INFO:foo:first message',
'ERROR:foo.bar:second message']) 'ERROR:foo.bar:second message'])
def test_key_size(self) -> None: # works
"""
t:tox_address_size
t:tox_file_id_length
t:tox_public_key_size
t:tox_secret_key_size
t:tox_group_max_topic_length
t:tox_group_max_part_length
t:tox_group_max_message_length
t:tox_group_max_custom_lossy_packet_length
t:tox_group_max_custom_lossless_packet_length
t:tox_group_max_group_name_length
t:tox_group_max_password_size
t:tox_group_chat_id_size
t:tox_group_peer_public_key_size
"""
otox = self.bob
for elt in (
'tox_address_size',
'tox_version_major',
'tox_version_minor',
'tox_version_patch',
'tox_file_id_length',
'tox_public_key_size',
'tox_secret_key_size',
'tox_group_max_topic_length',
'tox_group_max_part_length',
'tox_group_max_message_length',
'tox_group_max_custom_lossy_packet_length',
'tox_group_max_custom_lossless_packet_length',
'tox_group_max_group_name_length',
'tox_group_max_password_size',
'tox_group_chat_id_size',
'tox_group_peer_public_key_size',
'tox_hash_length',
'tox_max_custom_packet_size',
'tox_max_filename_length',
'tox_max_friend_request_length',
'tox_max_hostname_length',
'tox_max_message_length',
'tox_max_name_length',
'tox_max_status_message_length',
'tox_nospam_size',
'tox_pass_salt_length',
):
ret = getattr(otox, elt)()
LOG.info(f"test_key_size: {elt} -> {ret} ")
def test_hash(self): # works def test_hash(self): # works
otox = self.bob otox = self.bob
string = 'abcdef' string = 'abcdef'
@ -717,15 +765,15 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
AssertionError("ERROR: NOT CONNECTED " \ AssertionError("ERROR: NOT CONNECTED " \
+repr(self.alice.self_get_connection_status())) +repr(self.alice.self_get_connection_status()))
def test_bob_assert_mycon_status(self) -> None: # works def test_bob_assert_self_conn_status(self) -> None: # works
if self.bob.mycon_status == False: if self.bob.self_conn_status == False:
AssertionError("ERROR: NOT CONNECTED " \ AssertionError("ERROR: NOT CONNECTED " \
+repr(self.bob.mycon_status)) +repr(self.bob.self_conn_status))
def test_alice_assert_mycon_status(self) -> None: # works def test_alice_assert_self_conn_status(self) -> None: # works
if self.alice.mycon_status == False: if self.alice.self_conn_status == False:
AssertionError("ERROR: NOT CONNECTED " \ AssertionError("ERROR: NOT CONNECTED " \
+repr(self.alice.mycon_status)) +repr(self.alice.self_conn_status))
def test_bob_add_alice_as_friend(self) -> None: # works? def test_bob_add_alice_as_friend(self) -> None: # works?
try: try:
@ -873,7 +921,16 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
LOG_INFO(f"BOB_ON_friend_status_message friend_id={friend_id} " \ LOG_INFO(f"BOB_ON_friend_status_message friend_id={friend_id} " \
+f"new_status_message={new_status_message}") +f"new_status_message={new_status_message}")
try: try:
assert str(new_status_message, 'UTF-8') == MSG assert new_status_size == len(MSG), new_status_size
if type(new_status_message) == bytes:
assert str(new_status_message[:new_status_size], 'UTF-8') == MSG, \
f"new_status_message={new_status_message}"
elif type(new_status_message) == str:
assert new_status_message[:new_status_size] == MSG, \
f"new_status_message={new_status_message}"
else:
# new_status_message=<toxygen_wrapper.tox.LP_c_ubyte object at 0x79015e9f9c70>
raise RuntimeError("unrecognized type type(new_status_message)")
assert friend_id == self.baid assert friend_id == self.baid
except Exception as e: except Exception as e:
LOG_ERROR(f"BOB_ON_friend_status_message EXCEPTION {e}") LOG_ERROR(f"BOB_ON_friend_status_message EXCEPTION {e}")
@ -900,10 +957,10 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
if not self.wait_otox_attrs(self.bob, [sSlot]): if not self.wait_otox_attrs(self.bob, [sSlot]):
raise AssertionError(f"on_friend_status_message NO {sSlot}") raise AssertionError(f"on_friend_status_message NO {sSlot}")
assert self.bob.friend_get_status_message(self.baid) == MSG, \ if not self.bob.friend_get_status_message(self.baid) == MSG:
f"message={self.bob.friend_get_status_message(self.baid)}" LOG.warn(f"message={self.bob.friend_get_status_message(self.baid)}")
assert self.bob.friend_get_status_message_size(self.baid) == len(MSG), \ if not self.bob.friend_get_status_message_size(self.baid) == len(MSG):
f"message_len={self.bob.friend_get_status_message_size(self.baid)}" LOG.warn(f"message_len={self.bob.friend_get_status_message_size(self.baid)}")
except AssertionError as e: except AssertionError as e:
LOG.error(f"test_on_friend_status_message FAILED {e}") LOG.error(f"test_on_friend_status_message FAILED {e}")
@ -1068,11 +1125,15 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
LOG.info("test_typing_status bob adding alice") LOG.info("test_typing_status bob adding alice")
#: Test typing status #: Test typing status
def bob_on_friend_typing(iTox, fid:int, is_typing, *largs) -> None: def bob_on_friend_typing(iTox, fid:int, is_typing, *largs) -> None:
LOG_INFO(f"BOB_ON_friend_typing is_typing={is_typing} fid={fid}")
try: try:
assert fid == self.baid assert fid == self.baid
if is_typing is True: if is_typing is True:
assert self.bob.friend_get_typing(fid) is True LOG_INFO(f"BOB_ON_friend_typing is_typing={is_typing} fid={fid}")
assert self.bob.friend_get_typing(fid) is True, \
'self.bob.friend_get_typing'
else:
LOG_DEBUG(f"BOB_ON_friend_typing is_typing={is_typing} fid={fid}")
except Exception as e: except Exception as e:
LOG_ERROR(f"BOB_ON_friend_typing {e}") LOG_ERROR(f"BOB_ON_friend_typing {e}")
setattr(self.bob, sSlot, True) setattr(self.bob, sSlot, True)
@ -1085,11 +1146,12 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
assert self.both_add_as_friend() assert self.both_add_as_friend()
if not self.get_connection_status(): if not self.get_connection_status():
LOG.warning(f"test_friend_typing_status NOT CONNECTED")
self.loop_until_connected(self.bob) self.loop_until_connected(self.bob)
self.bob.callback_friend_typing(bob_on_friend_typing) self.bob.callback_friend_typing(bob_on_friend_typing)
self.warn_if_no_cb(self.bob, sSlot) self.warn_if_no_cb(self.bob, sSlot)
self.alice.self_set_typing(self.abid, False) self.alice.self_set_typing(self.abid, True)
if not self.wait_otox_attrs(self.bob, [sSlot]): if not self.wait_otox_attrs(self.bob, [sSlot]):
raise AssertionError(f"bobs_on_friend_typing NO {sSlot}") raise AssertionError(f"bobs_on_friend_typing NO {sSlot}")
except AssertionError as e: except AssertionError as e:

View File

@ -8,7 +8,7 @@ import sys
import time import time
import threading import threading
from ctypes import * from ctypes import *
from typing import Union, Callable from typing import Union, Callable, Optional
import toxygen_wrapper.toxcore_enums_and_consts as enums import toxygen_wrapper.toxcore_enums_and_consts as enums
from toxygen_wrapper.tox import Tox, UINT32_MAX, ToxError from toxygen_wrapper.tox import Tox, UINT32_MAX, ToxError
@ -100,7 +100,7 @@ class WrapperMixin():
self.bob.iterate() self.bob.iterate()
sleep(interval / 1000.0) sleep(interval / 1000.0)
def call_bootstrap(self, num: Union[int, None] = None, lToxes:Union[list[int], None] =None, i:int =0, fsocket_timeout:float = fSOCKET_TIMEOUT) -> None: def call_bootstrap(self, num: Optional[int] = None, lToxes:Union[list[int], None] =None, i:int =0, fsocket_timeout:float = fSOCKET_TIMEOUT) -> None:
if num == None: num=ts.iNODES if num == None: num=ts.iNODES
if lToxes is None: if lToxes is None:
lToxes = [self.alice, self.bob] lToxes = [self.alice, self.bob]
@ -123,7 +123,7 @@ class WrapperMixin():
LOG.debug(f"call_bootstrap ts.bootstrap_tcp {len(lElts)}") LOG.debug(f"call_bootstrap ts.bootstrap_tcp {len(lElts)}")
ts.bootstrap_tcp(lElts, lToxes, fsocket_timeout=fsocket_timeout) ts.bootstrap_tcp(lElts, lToxes, fsocket_timeout=fsocket_timeout)
def group_until_connected(self, otox, group_number:int, num: Union[int, None] = None, iMax:int = THRESHOLD, fsocket_timeout:float = fSOCKET_TIMEOUT) -> bool: def group_until_connected(self, otox, group_number:int, num: Optional[int] = None, iMax:int = THRESHOLD, fsocket_timeout:float = fSOCKET_TIMEOUT) -> bool:
""" """
""" """
i = 0 i = 0
@ -131,7 +131,7 @@ class WrapperMixin():
while i <= iMax : while i <= iMax :
i += 1 i += 1
iRet = otox.group_is_connected(group_number) iRet = otox.group_is_connected(group_number)
if iRet == True or iRet == 0: if iRet == True:
bRet = True bRet = True
break break
if i % 5 == 0: if i % 5 == 0:
@ -139,18 +139,15 @@ class WrapperMixin():
self.call_bootstrap(num, lToxes=None, i=j, fsocket_timeout=fsocket_timeout) self.call_bootstrap(num, lToxes=None, i=j, fsocket_timeout=fsocket_timeout)
s = '' s = ''
if i == 0: s = '\n' if i == 0: s = '\n'
LOG.info(s+"group_until_connected " \ LOG.info(s+f"group_until_connected #{i} iRet={iRet}" \
+" #" + str(i) \ +f" BOBS={otox.self_conn_status}" \
+" iRet=" +repr(iRet) \
+f" BOBS={otox.mycon_status}" \
+f" last={int(otox.mycon_time)}" ) +f" last={int(otox.mycon_time)}" )
self.loop(iLOOP_N) self.loop(iLOOP_N)
else: else:
bRet = False bRet = False
if bRet: if bRet:
LOG.info(f"group_until_connected True i={i}" \ LOG.info(f"group_until_connected True i={i} iMax={iMax}" \
+f" iMax={iMax}" \
+f" BOB={otox.self_get_connection_status()}" \ +f" BOB={otox.self_get_connection_status()}" \
+f" last={int(otox.mycon_time)}" ) +f" last={int(otox.mycon_time)}" )
return True return True
@ -161,7 +158,7 @@ class WrapperMixin():
+f" last={int(otox.mycon_time)}" ) +f" last={int(otox.mycon_time)}" )
return False return False
def loop_until_connected(self, otox=None, num: Union[int, None] = None, fsocket_timeout:float = fSOCKET_TIMEOUT) -> bool: def loop_until_connected(self, otox=None, num: Optional[int] = None, fsocket_timeout:float = fSOCKET_TIMEOUT) -> bool:
""" """
t:on_self_connection_status t:on_self_connection_status
t:self_get_connection_status t:self_get_connection_status
@ -172,7 +169,7 @@ class WrapperMixin():
if otox is None: otox = self.bob if otox is None: otox = self.bob
while i <= otox._args.test_timeout : while i <= otox._args.test_timeout :
i += 1 i += 1
if (self.alice.mycon_status and self.bob.mycon_status): if (self.alice.self_conn_status and self.bob.self_conn_status):
bRet = True bRet = True
break break
if i % 5 == 0: if i % 5 == 0:
@ -184,17 +181,17 @@ class WrapperMixin():
+" #" + str(i) \ +" #" + str(i) \
+" BOB=" +repr(self.bob.self_get_connection_status()) \ +" BOB=" +repr(self.bob.self_get_connection_status()) \
+" ALICE=" +repr(self.alice.self_get_connection_status()) +" ALICE=" +repr(self.alice.self_get_connection_status())
+f" BOBS={self.bob.mycon_status}" \ +f" BOBS={self.bob.self_conn_status}" \
+f" ALICES={self.alice.mycon_status}" \ +f" ALICES={self.alice.self_conn_status}" \
+f" last={int(self.bob.mycon_time)}" ) +f" last={int(self.bob.mycon_time)}" )
if (self.alice.mycon_status and self.bob.mycon_status): if (self.alice.self_conn_status and self.bob.self_conn_status):
bRet = True bRet = True
break break
if (self.alice.self_get_connection_status() and if (self.alice.self_get_connection_status() and
self.bob.self_get_connection_status()): self.bob.self_get_connection_status()):
LOG_WARN(f"loop_until_connected disagree status() DISAGREE" \ LOG_WARN(f"loop_until_connected disagree status() DISAGREE" \
+f' self.bob.mycon_status={self.bob.mycon_status}' \ +f' self.bob.self_conn_status={self.bob.self_conn_status}' \
+f' alice.mycon_status={self.alice.mycon_status}' \ +f' alice.self_conn_status={self.alice.self_conn_status}' \
+f" last={int(self.bob.mycon_time)}" ) +f" last={int(self.bob.mycon_time)}" )
bRet = True bRet = True
break break
@ -459,23 +456,12 @@ class WrapperMixin():
assert self.bob_add_alice_as_friend() assert self.bob_add_alice_as_friend()
#: Wait until both are online #: Wait until both are online
sSlot = 'friend_conn_status'
setattr(self.bob, sSlot, False)
def bobs_on_friend_connection_status(iTox, friend_id, iStatus, *largs) -> None:
LOG_INFO(f"bobs_on_friend_connection_status {friend_id} ?>=0" +repr(iStatus))
setattr(self.bob, sSlot, False)
sSlot = 'friend_status' sSlot = 'friend_status'
setattr(self.bob, sSlot, None) setattr(self.bob, sSlot, None)
def bobs_on_friend_status(iTox, friend_id, iStatus, *largs) -> None: def bobs_on_friend_status(iTox, friend_id, iStatus, *largs) -> None:
LOG_INFO(f"bobs_on_friend_status {friend_id} ?>=0 iS={iStatus}") LOG_INFO(f"bobs_on_friend_status {friend_id} ?>=0 iS={iStatus}")
setattr(self.bob, sSlot, False) setattr(self.bob, sSlot, False)
sSlot = 'friend_conn_status'
setattr(self.alice, sSlot, None)
def alices_on_friend_connection_status(iTox, friend_id, iStatus, *largs) -> None:
LOG_INFO(f"alices_on_friend_connection_status {friend_id} ?>=0 " +repr(iStatus))
setattr(self.alice, sSlot, False)
sSlot = 'friend_status' sSlot = 'friend_status'
setattr(self.alice, sSlot, None) setattr(self.alice, sSlot, None)
@ -489,18 +475,18 @@ class WrapperMixin():
self.loop_until_connected(self.bob) self.loop_until_connected(self.bob)
LOG.info("bob_add_alice_as_friend_and_status waiting for alice connections") LOG.info("bob_add_alice_as_friend_and_status waiting for alice connections")
if not self.wait_otox_attrs(self.alice, if not self.wait_otox_attrs(self.alice,
['friend_conn_status', [ # 'friend_conn_status',
'friend_status']): 'friend_status']):
return False return False
self.bob.callback_friend_connection_status(bobs_on_friend_connection_status) # self.bob.callback_friend_connection_status(bobs_on_friend_connection_status)
self.bob.callback_friend_status(bobs_on_friend_status) self.bob.callback_friend_status(bobs_on_friend_status)
self.alice.callback_friend_connection_status(alices_on_friend_connection_status) # self.alice.callback_friend_connection_status(alices_on_friend_connection_status)
self.alice.callback_friend_status(alices_on_friend_status) self.alice.callback_friend_status(alices_on_friend_status)
LOG.info("bob_add_alice_as_friend_and_status waiting for bob connections") LOG.info("bob_add_alice_as_friend_and_status waiting for bob connections")
if not self.wait_otox_attrs(self.bob, if not self.wait_otox_attrs(self.bob,
['friend_conn_status', [ # 'friend_conn_status',
'friend_status']): 'friend_status']):
LOG_WARN('bob_add_alice_as_friend_and_status NO') LOG_WARN('bob_add_alice_as_friend_and_status NO')
# return False # return False
@ -508,28 +494,12 @@ class WrapperMixin():
LOG.error(f"bob_add_alice_as_friend_and_status ERROR {e}") LOG.error(f"bob_add_alice_as_friend_and_status ERROR {e}")
return False return False
finally: finally:
self.alice.callback_friend_connection_status(None) # self.alice.callback_friend_connection_status(None)
self.bob.callback_friend_connection_status(None) # self.bob.callback_friend_connection_status(None)
self.alice.callback_friend_status(None) self.alice.callback_friend_status(None)
self.bob.callback_friend_status(None) self.bob.callback_friend_status(None)
return True return True
def bob_to_alice_connected(self) -> bool:
assert hasattr(self, 'baid')
iRet = self.bob.friend_get_connection_status(self.baid)
if iRet == TOX_CONNECTION['NONE']:
LOG.warn("bob.friend_get_connection_status")
return False
return True
def alice_to_bob_connected(self) -> bool:
assert hasattr(self, 'abid')
iRet = self.alice.friend_get_connection_status(self.abid)
if iRet == TOX_CONNECTION['NONE']:
LOG.error("alice.friend_get_connection_status")
return False
return True
def otox_test_groups_create(self, def otox_test_groups_create(self,
otox, otox,
group_name='test_group', group_name='test_group',

File diff suppressed because it is too large Load Diff