From c743257059d0f521b74f1c1e175a4c77cfabd889 Mon Sep 17 00:00:00 2001 From: epiphyte Date: Tue, 30 Dec 2025 16:59:48 -0500 Subject: [PATCH] Dev - update test which invoke initFromArgV to use withSetLoggingMock --- synapse/tests/test_lib_aha.py | 5 +---- synapse/tests/test_lib_cell.py | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/synapse/tests/test_lib_aha.py b/synapse/tests/test_lib_aha.py index b0df5222ca0..98f67cb1544 100644 --- a/synapse/tests/test_lib_aha.py +++ b/synapse/tests/test_lib_aha.py @@ -548,10 +548,7 @@ async def test_lib_aha_provision(self): conf = {'dns:name': 'aha.loop.vertex.link'} async with self.getTestAha(dirn=dirn, conf=conf) as aha: - - ahaport = aha.sockaddr[1] - - url = aha.getLocalUrl() + await aha.enter_context(self.withSetLoggingMock()) outp = self.getTestOutp() await s_tools_provision_service.main(('--url', aha.getLocalUrl(), 'foobar'), outp=outp) diff --git a/synapse/tests/test_lib_cell.py b/synapse/tests/test_lib_cell.py index e3f81b8cc4a..d2a2831267c 100644 --- a/synapse/tests/test_lib_cell.py +++ b/synapse/tests/test_lib_cell.py @@ -1687,14 +1687,15 @@ async def test_cell_auth_userlimit(self): with self.setTstEnvars(SYN_CELL_MAX_USERS=str(maxusers)): with self.getTestDir() as dirn: - argv = [dirn, '--https', '0', '--telepath', 'tcp://0.0.0.0:0'] - async with await s_cell.Cell.initFromArgv(argv) as cell: - await cell.auth.addUser('visi1') - await cell.auth.addUser('visi2') - await cell.auth.addUser('visi3') - with self.raises(s_exc.HitLimit) as exc: - await cell.auth.addUser('visi4') - self.eq(f'Cell at maximum number of users ({maxusers}).', exc.exception.get('mesg')) + async with self.withSetLoggingMock(): + argv = [dirn, '--https', '0', '--telepath', 'tcp://0.0.0.0:0'] + async with await s_cell.Cell.initFromArgv(argv) as cell: + await cell.auth.addUser('visi1') + await cell.auth.addUser('visi2') + await cell.auth.addUser('visi3') + with self.raises(s_exc.HitLimit) as exc: + await cell.auth.addUser('visi4') + self.eq(f'Cell at maximum number of users ({maxusers}).', exc.exception.get('mesg')) with self.raises(s_exc.BadConfValu) as exc: async with self.getTestCell(s_cell.Cell, conf={'max:users': -1}) as cell: @@ -2194,6 +2195,7 @@ async def test_mirror_badiden(self): async def test_backup_restore_base(self): async with self.getTestAxon(conf={'auth:passwd': 'root'}) as axon: + await axon.enter_context(self.withSetLoggingMock()) addr, port = await axon.addHttpsPort(0) url = f'https+insecure://root:root@localhost:{port}/api/v1/axon/files/by/sha256/' @@ -2320,7 +2322,7 @@ async def test_backup_restore_aha(self): # backup the mirror # restore the backup async with self.getTestAha() as aha: # type: s_aha.AhaCell - + await aha.enter_context(self.withSetLoggingMock()) with self.getTestDir() as dirn: cdr0 = s_common.genpath(dirn, 'core00') cdr1 = s_common.genpath(dirn, 'core01') @@ -2403,7 +2405,7 @@ async def test_backup_restore_double_promote_aha(self): # backup the mirror # restore the backup async with self.getTestAha() as aha: # type: s_aha.AhaCell - + await aha.enter_context(self.withSetLoggingMock()) with self.getTestDir() as dirn: cdr0 = s_common.genpath(dirn, 'core00') cdr1 = s_common.genpath(dirn, 'core01')