I tried several options and that's the one I manage to get working, however, I accept suggestions to improve it. I think I'm understanding more and more how unit tests work in perl so if you are able to extend your suggestion... I tried to MockModule approach using the fakeModule method (as far as I know we do it automatically for EBox::Config) but gave me problems (the override didn't work) and had to fallback into this...