Patch Stream methods with mock

The original code did not patch the methods but assigned mocks
effectively leaving the mock objects existent even after the
test has finished.

Closes-Bug: #2129284

Change-Id: I61da9b061ed4c0c78c2a84d889ed6f39928329cc
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
This commit is contained in:
Jakub Libosvar
2025-10-21 19:01:12 +00:00
parent 3969739c9f
commit bcb21726b3

View File

@@ -187,9 +187,9 @@ class TestOvnConnection(base.BaseTestCase):
def test_connection_nb_start(self):
ovn_conf.cfg.CONF.set_override('ovn_nb_private_key', 'foo-key', 'ovn')
Stream.ssl_set_private_key_file = mock.Mock()
Stream.ssl_set_certificate_file = mock.Mock()
Stream.ssl_set_ca_cert_file = mock.Mock()
mock.patch.object(Stream, 'ssl_set_private_key_file').start()
mock.patch.object(Stream, 'ssl_set_certificate_file').start()
mock.patch.object(Stream, 'ssl_set_ca_cert_file').start()
self._test_connection_start(idl_class=ovsdb_monitor.OvnNbIdl,
schema='OVN_Northbound')