Prevent classes that want to check the filesystem from breaking the
simple daemon forms instantiation test case. A better future fix would
be avoiding checking the file system during __init__ of the class but
that is left for future improvements.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
assert isinstance(inst, daemon_form.SysctlDaemonForm) == is_sdf
-def test_can_create_all_daemon_forms():
+def test_can_create_all_daemon_forms(monkeypatch):
uuid = 'daeb985e-58c7-11ee-a536-201e8814f771'
ctx = mock.MagicMock()
ctx.config_blobs = {
'pool': 'swimming',
'destination': 'earth',
}
+ _os_path_isdir = mock.MagicMock(return_value=True)
+ monkeypatch.setattr('os.path.isdir', _os_path_isdir)
dtypes = _cephadm.get_supported_daemons()
for daemon_type in dtypes:
if daemon_type == 'agent':