@@ -34,10 +34,23 @@ def test_network_both():
3434
3535@mock .patch ("linuxmusterLinuxclient7.config.constants.legacyNetworkConfigFilePath" , f"/does/not/exist/network.conf" )
3636@mock .patch ("linuxmusterLinuxclient7.config.constants.configFilePath" , f"/does/not/exist/config.yml" )
37- def test_network_none ():
37+ @mock .patch ("linuxmusterLinuxclient7.config.logging.exception" )
38+ def test_network_none (mockLoggingException ):
39+ # make sure that no confusing error message is logged when config file does not exist
3840 rc , networkConfig = config .network ()
3941 assert not rc
4042 assert networkConfig is None
43+ assert not mockLoggingException .called
44+
45+ @mock .patch ("linuxmusterLinuxclient7.config.constants.legacyNetworkConfigFilePath" , f"{ MOCK_FILE_PATH } /network.invalid.conf" )
46+ @mock .patch ("linuxmusterLinuxclient7.config.constants.configFilePath" , f"/does/not/exist/config.yml" )
47+ @mock .patch ("linuxmusterLinuxclient7.config.logging.exception" )
48+ def test_network_legacy_invalid (mockLoggingException ):
49+ # make sure that an error message is logged when the legacy config file exists but is invalid
50+ rc , networkConfig = config .network ()
51+ assert not rc
52+ assert networkConfig is None
53+ assert mockLoggingException .called
4154
4255@mock .patch ("linuxmusterLinuxclient7.config.constants.legacyNetworkConfigFilePath" , f"/does/not/exist/network.conf" )
4356@mock .patch ("linuxmusterLinuxclient7.config.constants.configFilePath" , f"{ MOCK_FILE_PATH } /config.invalid-network.yml" )
0 commit comments