update
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
emdee@spm.plastiras.org 2024-02-19 12:45:23 +00:00
parent 11f8169e2b
commit 6e3dd26dad
8 changed files with 36 additions and 1858 deletions

View file

@ -635,7 +635,7 @@ def generate_nodes(oArgs,
nodes_count=nodes_count,
ipv=ipv,
udp_not_tcp=udp_not_tcp)
assert lNodes
assert lNodes, f"No nodes from {sFile}"
aNODES[sKey] = lNodes
return aNODES[sKey]

View file

@ -98,11 +98,11 @@ from toxygen_wrapper.toxcore_enums_and_consts import (TOX_ADDRESS_SIZE,
try:
import support_testing as ts
import support_onions as so
from wrapper_mixin import WrapperMixin
except ImportError:
import toxygen_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_onions as so
from wrapper_mixin import WrapperMixin
from tox_wrapper.wrapper_mixin import WrapperMixin
try:
from tests.toxygen_tests import test_sound_notification
@ -132,7 +132,6 @@ else:
ADDR_SIZE = 38 * 2
CLIENT_ID_SIZE = 32 * 2
THRESHOLD = 120 # >25
fSOCKET_TIMEOUT = 15.0
iN = 6
@ -1261,6 +1260,8 @@ class ToxSuite(unittest.TestCase, WrapperMixin):
if hasattr(self, 'abid') and self.abid >= 0:
self.alice.friend_delete(self.abid)
@unittest.skipIf( not os.environ.get('TOR_CONTROLLER_PASSWORD', ''), \
"Requires tor controller password")
def test_onion_intros(self) -> None: # timeout intermittently
# introduction points are needed for onion services
if self.bob._args.proxy_type == 2:
@ -1649,6 +1650,10 @@ def oTestsToxOptions(oArgs):
def oArgparse(lArgv):
global THRESHOLD
if os.environ.get('socks_proxy'):
THRESHOLD = 150 # >25
else:
THRESHOLD = 30 # >25
parser = ts.oMainArgparser()
parser.add_argument('--norequest',type=str, default='False',
choices=['True','False'],

View file

@ -299,10 +299,11 @@ class WrapperMixin():
def bob_add_alice_as_friend_norequest(self) -> bool:
if not self.bBobNeedAlice(): return True
iRet = self.bob.friend_add_norequest(self.alice._address)
apk = self.alice.self_get_public_key()
iRet = self.bob.friend_add_norequest(apk)
if iRet < 0:
return False
self.baid = self.bob.friend_by_public_key(self.alice._address)
self.baid = self.bob.friend_by_public_key(apk)
assert self.baid >= 0, self.baid
assert self.bob.friend_exists(self.baid), "bob.friend_exists"
assert not self.bob.friend_exists(self.baid + 1)
@ -313,10 +314,11 @@ class WrapperMixin():
def alice_add_bob_as_friend_norequest(self) -> bool:
if not self.bAliceNeedAddBob(): return True
iRet = self.alice.friend_add_norequest(self.bob._address)
bpk = self.bob.self_get_public_key()
iRet = self.alice.friend_add_norequest(bpk)
if iRet < 0:
return False
self.abid = self.alice.friend_by_public_key(self.bob._address)
self.abid = self.alice.friend_by_public_key(bpk)
assert self.abid >= 0, self.abid
assert self.abid in self.alice.self_get_friend_list()
assert self.alice.friend_exists(self.abid), "alice.friend_exists"
@ -376,6 +378,7 @@ class WrapperMixin():
setattr(self.bob, sSlot, True)
setattr(self.bob, sSlot, None)
apk = self.alice.self_get_public_key()
inum = -1
try:
inum = self.bob.friend_add(self.alice._address, bytes(MSG, 'UTF-8'))
@ -387,8 +390,8 @@ class WrapperMixin():
self.alice.callback_friend_request(alices_on_friend_request)
if not self.wait_otox_attrs(self.bob, [sSlot]):
LOG_WARN(f"bob_add_alice_as_friend NO setting {sSlot}")
# return False
self.baid = self.bob.friend_by_public_key(self.alice._address)
return False
self.baid = self.bob.friend_by_public_key(apk)
assert self.baid >= 0, self.baid
assert self.bob.friend_exists(self.baid)
assert not self.bob.friend_exists(self.baid + 1)
@ -427,6 +430,7 @@ class WrapperMixin():
LOG_INFO(f"bobs_on_friend_request: {sSlot} = True ")
setattr(self.alice, sSlot, None)
bpk = self.bob.self_get_public_key()
inum = -1
try:
inum = self.alice.friend_add(self.bob._address, bytes(MSG, 'UTF-8'))
@ -434,8 +438,8 @@ class WrapperMixin():
self.bob.callback_friend_request(bobs_on_friend_request)
if not self.wait_otox_attrs(self.alice, [sSlot]):
LOG_WARN(f"alice.friend_add NO wait {sSlot}")
#? return False
self.abid = self.alice.friend_by_public_key(self.bob._address)
return False
self.abid = self.alice.friend_by_public_key(bpk)
assert self.abid >= 0, self.abid
assert self.alice.friend_exists(self.abid), "not exists"
assert not self.alice.friend_exists(self.abid + 1), "exists +1"
@ -683,4 +687,3 @@ class WrapperMixin():
if hasattr(self.bob, sSlot+'_cb') and \
getattr(self.bob, sSlot+'_cb'):
LOG.warning(f"self.bob.{sSlot}_cb EXIST")