Пример #1
0
    def test_it_doesnt_care_if_no_config_file(self):
        config_util = ConfigUtil()
        fake_find_config_file = fudge.Fake("find_config_file").expects_call().returns(None)
        fake_apply_config_file = fudge.Fake("apply_config_file")

        with fudge.patched_context(config_util, 'find_config_file', fake_find_config_file):
            with fudge.patched_context(config_util, 'apply_config_file', fake_apply_config_file):
                config_util.use_config_file()
Пример #2
0
    def test_it_applies_config_file_if_one_is_found(self):
        config_util = ConfigUtil()
        config_file = fudge.Fake("config_file")
        fake_find_config_file = fudge.Fake("find_config_file").expects_call().returns(config_file)
        fake_apply_config_file = fudge.Fake("apply_config_file").expects_call().with_args(config_file)

        with fudge.patched_context(config_util, 'find_config_file', fake_find_config_file):
            with fudge.patched_context(config_util, 'apply_config_file', fake_apply_config_file):
                config_util.use_config_file()