[FIX] fix tests failing in ci

This commit is contained in:
hugues de keyzer
2023-07-10 22:28:01 +02:00
parent 74851db119
commit 887ac14cf9

View File

@@ -60,8 +60,9 @@ class TestBaseExternalDbsource(common.TransactionCase):
def test_connection_success(self): def test_connection_success(self):
""" It should raise for successful connection """ """ It should raise for successful connection """
with self.assertRaises(ConnectionSuccessError): with mock.patch.object(self.dbsource, 'connection_open_postgresql'):
self.dbsource.connection_test() with self.assertRaises(ConnectionSuccessError):
self.dbsource.connection_test()
def test_connection_fail(self): def test_connection_fail(self):
""" It should raise for failed/invalid connection """ """ It should raise for failed/invalid connection """
@@ -72,12 +73,13 @@ class TestBaseExternalDbsource(common.TransactionCase):
def test_connection_open_calls_close(self): def test_connection_open_calls_close(self):
""" It should close connection after context ends """ """ It should close connection after context ends """
with mock.patch.object( with mock.patch.object(self.dbsource, 'connection_open_postgresql'):
self.dbsource, 'connection_close', with mock.patch.object(
) as close: self.dbsource, 'connection_close',
with self.dbsource.connection_open(): ) as close:
pass with self.dbsource.connection_open():
close.assert_called_once() pass
close.assert_called_once()
def test_connection_close(self): def test_connection_close(self):
""" It should call adapter's close method """ """ It should call adapter's close method """