1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

python:tests/rpcd_witness_samba_only: add tests for 'net witness force-unregister'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-01-15 14:20:00 +01:00
parent 8536a21792
commit 8a643fea95

View File

@ -1138,6 +1138,40 @@ class RpcdWitnessSambaTests(BlackboxTestCase):
'SHARE_MOVE_TO',
witness.WITNESS_NOTIFY_SHARE_MOVE)
def test_net_witness_force_unregister(self):
def check_force_unregister(regs,
apply_to_all=False,
registration_idx=None,
net_name=None,
share_name=None,
ip_address=None,
client_computer=None):
def check_force_unregister_happened(reg):
conn = reg['conn']
reg_context = reg['context']
self.assertIsNotNone(reg_context)
try:
conn.UnRegister(reg_context)
self.fail()
except WERRORError as e:
(num, string) = e.args
if num != werror.WERR_NOT_FOUND:
raise
reg['context'] = None
return self.check_net_witness_output("force-unregister",
regs,
apply_to_all=apply_to_all,
registration_idx=registration_idx,
net_name=net_name,
share_name=share_name,
ip_address=ip_address,
client_computer=client_computer,
expected_msg_type="FORCE_UNREGISTER",
callback=check_force_unregister_happened)
self.check_combinations(check_force_unregister)
if __name__ == "__main__":
import unittest
unittest.main()