Пример #1
0
    def setUp(self):
        """
        This method setup everything that is needed for the test.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.types = ["up", "down", "invalid", "tested"]
Пример #2
0
    def setUp(self):
        """
        This method setup everything that is needed.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.exception_message = "Impossible to switch %s. Please post an issue to https://github.com/funilrys/PyFunceble/issues."  # pylint:disable=line-too-long
Пример #3
0
    def setUp(self):
        """
        This method setup everything that is needed.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.file = PyFunceble.OUTPUTS["parent_directory"] + "hello_world"
        self.types = ["up", "down", "invalid", "tested"]
Пример #4
0
def load_config():  # pragma: no cover
    """
    This function will load the configuration.
    """

    global CURRENT_DIRECTORY  # pylint:disable=global-statement
    Load(CURRENT_DIRECTORY)

    if OUTPUTS["main"]:
        CURRENT_DIRECTORY = OUTPUTS["main"]

        if not CURRENT_DIRECTORY.endswith(directory_separator):
            CURRENT_DIRECTORY += directory_separator

        if path.isfile(CURRENT_DIRECTORY + ".PyFunceble.yaml"):
            Load(CURRENT_DIRECTORY)

    if not path.isdir(CURRENT_DIRECTORY + OUTPUTS["parent_directory"]):
        DirectoryStructure()
Пример #5
0
    def setUp(self):
        """
        Setup everything needed for the tests
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        BaseStdout.setUp(self)
        PyFunceble.CONFIGURATION["show_execution_time"] = True
        PyFunceble.INTERN["start"] = int(PyFunceble.time())
        PyFunceble.INTERN["end"] = int(PyFunceble.time()) + 15
Пример #6
0
    def setUp(self):
        """
        This method will load everything needed for the tests
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        BaseStdout.setUp(self)
        PyFunceble.CONFIGURATION["show_execution_time"] = True
        PyFunceble.CONFIGURATION["start"] = int(PyFunceble.strftime("%s"))
        PyFunceble.CONFIGURATION["end"] = int(PyFunceble.strftime("%s")) + 15
Пример #7
0
    def setUp(self):
        """
        This method setup the needed variables.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.file = PyFunceble.OUTPUTS["parent_directory"] + PyFunceble.OUTPUTS["logs"][
            "filenames"
        ][
            "auto_continue"
        ]
        PyFunceble.CONFIGURATION["file_to_test"] = "hello.world"
        self.types = ["up", "down", "invalid", "tested"]
Пример #8
0
    def setUp(self):
        """
        Setup the needed variables.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)

        self.file_to_work_with = (
            PyFunceble.OUTPUT_DIRECTORY +
            PyFunceble.OUTPUTS["parent_directory"] +
            PyFunceble.OUTPUTS["logs"]["filenames"]["auto_continue"])

        PyFunceble.INTERN["file_to_test"] = "hello.world"
        self.types = ["up", "down", "invalid", "tested"]
Пример #9
0
    def setUp(self):
        """
        This method setup everything that is needed for the tests.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.domains = [
            "google.com",
            "twitter.com",
            "github.com",
            "facebook.com",
            "hello.world",
            "world.hello",
        ]
Пример #10
0
def load_config(under_test=False):  # pragma: no cover
    """
    Load the configuration.

    :param under_test:
        Tell us if we only have to load the configuration file (True)
        or load the configuration file and initate the output directory
        if it does not exist (False).
    :type under_test: bool
    """

    # We load and download the different configuration file if they are non
    # existant.
    Load(CURRENT_DIRECTORY)

    if not under_test:
        # If we are not under test which means that we want to save informations,
        # we initiate the directory structure.
        DirectoryStructure()
Пример #11
0
    def setUp(self):
        """
        This method setup everything needed for the test.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)
        self.lines = [
            "||google.com$script,image",
            "||twitter.com^",
            "||api.google.com/papi/action$popup",
            "facebook.com###player-above-2",
            "~github.com,hello.world##.wrapper",
            "@@||cnn.com/*ad.xml",
            "!||world.hello/*ad.xml",
            "bing.com,bingo.com#@##adBanner",
            "!@@||funceble.world/js",
            "yahoo.com,msn.com,api.hello.world#@#awesomeWorld",
            "!funilrys.com##body",
            "hello#@#badads",
            "hubgit.com|oohay.com|ipa.elloh.dlorw#@#awesomeWorld",
        ]

        self.expected = [
            "google.com",
            "twitter.com",
            "api.google.com",
            "facebook.com",
            "github.com",
            "hello.world",
            "cnn.com",
            "world.hello",
            "bing.com",
            "bingo.com",
            "funceble.world",
            "api.hello.world",
            "msn.com",
            "yahoo.com",
            "funilrys.com",
            "hubgit.com",
            "ipa.elloh.dlorw",
            "oohay.com",
        ]
Пример #12
0
def load_config(under_test=False, custom=None):  # pragma: no cover
    """
    Load the configuration.

    :param under_test:
        Tell us if we only have to load the configuration file (True)
        or load the configuration file and initate the output directory
        if it does not exist (False).
    :type under_test: bool

    :param custom:
        A dict with the configuration index (from .PyFunceble.yaml) to update.
    :type custom: dict

    .. warning::
        If :code:`custom` is given, the given :code:`dict` overwrite
        the last value of the given configuration indexes.
    """

    if "config_loaded" not in INTERN:
        # The configuration was not already loaded.

        # We load and download the different configuration file if they are non
        # existant.
        Load(CURRENT_DIRECTORY)

        if not under_test:
            # If we are not under test which means that we want to save informations,
            # we initiate the directory structure.
            DirectoryStructure()

        # We save that the configuration was loaded.
        INTERN.update({"config_loaded": True})

        if custom and isinstance(custom, dict):
            # The given configuration is not None or empty.
            # and
            # It is a dict.

            # We update the configuration index.
            CONFIGURATION.update(custom)
Пример #13
0
    def setUp(self):
        """
        This method setup everything needed.
        """

        initiate(True)
        Load(PyFunceble.CURRENT_DIRECTORY)

        BaseStdout.setUp(self)
        logo = """
██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

"""

        self.logo_green = Fore.GREEN + logo
        self.logo_red = Fore.RED + logo
Пример #14
0
    def almost_everything(self, clean_all=False):
        """
        Delete almost all discovered files.

        :param clean_all:
            Tell the subsystem if we have to clean everything instesd
            of almost everything.
        :type clean_all: bool
        """

        # We get the list of file to delete.
        to_delete = self.file_to_delete()

        if clean_all:  # pragma: no cover
            to_delete.extend(self.databases_to_delete())

        for file in to_delete:
            # We loop through the list of file to delete.

            # And we delete the currently read file.
            File(file).delete()

        if clean_all:  # pragma: no cover
            Load(PyFunceble.CURRENT_DIRECTORY)
Пример #15
0
    def setUp(self):
        """
        This method setup everything that is needed for the test.
        """

        Load(PyFunceble.CURRENT_DIRECTORY)