From 50a384302073713911cb8f859a378b3bf8012e9c Mon Sep 17 00:00:00 2001 From: Thomas Sell Date: Thu, 4 Jan 2024 16:14:22 +0100 Subject: [PATCH] improve test coverage --- tests/test_irods_common.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_irods_common.py b/tests/test_irods_common.py index 156ae241..08ec6dfd 100644 --- a/tests/test_irods_common.py +++ b/tests/test_irods_common.py @@ -38,6 +38,16 @@ def test_init_irods(mocksession, fs): iRODSCommon()._init_irods() mocksession.assert_called() +@patch("cubi_tk.irods_common.iRODSCommon._init_irods") +def test_get_irods_sessions(mockinit): + with iRODSCommon()._get_irods_sessions(count = 4) as sessions: + [s for s in sessions] + assert mockinit.call_count == 4 + + mockinit.reset_mock() + with iRODSCommon()._get_irods_sessions(count = -1) as sessions: + [s for s in sessions] + assert mockinit.call_count == 1 @patch("getpass.getpass") @patch("cubi_tk.irods_common.iRODSSession") @@ -65,7 +75,6 @@ def test_save_irods_token(mocksession, mockencode, fs): assert icommon.irods_env_path.parent.joinpath(".irodsA").exists() mockencode.assert_called_with("secure") - # Test iRODSTransfer ######### @pytest.fixture def jobs():