Пример #1
0
    def test_guess_and_set_use_whois_db(self) -> None:
        """
        Tests the method which let us guess and set the value of the
        :code`use_whois_db` attribute.
        """

        config_loader = ConfigLoader()
        config_loader.custom_config = {"cli_testing": {"whois_db": False}}

        config_loader.start()

        self.checker.guess_and_set_use_whois_db()

        expected = False
        actual = self.checker.use_whois_db

        self.assertEqual(expected, actual)

        del config_loader
Пример #2
0
    def test_guess_and_set_use_extra_rules(self) -> None:
        """
        Tests the method which let us guess and set the value of the
        :code`use_extra_rules` attribute.
        """

        config_loader = ConfigLoader()
        config_loader.custom_config = {"lookup": {"special": False}}

        config_loader.start()

        self.checker.guess_and_set_use_extra_rules()

        expected = False
        actual = self.checker.use_extra_rules

        self.assertEqual(expected, actual)

        del config_loader
Пример #3
0
    def test_guess_and_set_use_reputation_lookup(self) -> None:
        """
        Tests the method which let us guess and set the value of the
        :code`use_reputation_lookup` attribute.
        """

        config_loader = ConfigLoader()
        config_loader.custom_config = {"lookup": {"reputation": True}}

        config_loader.start()

        self.checker.guess_and_set_use_reputation_lookup()

        expected = True
        actual = self.checker.use_reputation_lookup

        self.assertEqual(expected, actual)

        del config_loader
Пример #4
0
DirectoryHelper(PyFunceble.storage.CONFIG_DIRECTORY).create()
DirectoryHelper(pyfunceble_webworker.storage.CONFIG_DIRECTORY).create()

file_helper = FileHelper()
pyfunceble_config_loader = ConfigLoader()

if file_helper.set_path(
        os.path.join(
            pyfunceble_webworker.storage.CONFIG_DIRECTORY,
            assets_defaults.OVERWRITE_CONFIG_FILE,
        )).exists():
    local = DictHelper().from_yaml_file(file_helper.path)

    if local:
        pyfunceble_config_loader.custom_config = local
    else:
        pyfunceble_config_loader.custom_config = dict()
else:
    file_helper.write("")

pyfunceble_config_loader.custom_config = Merge(
    pyfunceble_defaults.PERSISTENT_CONFIG).into(
        pyfunceble_config_loader.custom_config)
pyfunceble_config_loader.start()

app = FastAPI(
    title=assets_defaults.PROJECT_NAME,
    description=assets_defaults.PROJECT_DESCRIPTION,
    version=__version__,
    docs_url=None,