Example #1
0
    def test_is_local_identical(self) -> None:
        """
        Tests the method which let us check if the given local configuration
        is identical to the upstream one.
        """

        given_local = copy.deepcopy(self.our_config)
        given_upstream = copy.deepcopy(self.our_config)

        config_comparison = ConfigComparison(local_config=given_local,
                                             upstream_config=given_upstream)

        expected = True
        actual = config_comparison.is_local_identical()

        self.assertEqual(expected, actual)
Example #2
0
    def test_is_local_identical_missing_key(self) -> None:
        """
        Tests the method which let us check if the given local configuration
        is identical to the upstream one for the case that a key is missing.
        """

        given_upstream = copy.deepcopy(self.our_config)

        to_delete = ["links", "http_codes", "user_agent"]

        for index in to_delete:
            given_local = copy.deepcopy(self.our_config)
            del given_local[index]

            config_comparison = ConfigComparison(
                local_config=given_local, upstream_config=given_upstream)

            expected = False
            actual = config_comparison.is_local_identical()

            self.assertEqual(expected, actual)
Example #3
0
    def test_is_local_identical_uneeded_links_key(self) -> None:
        """
        Tests the method which let us check if the given local configuration
        is identical to the upstream one for the case that a unneeded key
        inside the list of links is given.
        """

        given_upstream = copy.deepcopy(self.our_config)

        given_local = copy.deepcopy(self.our_config)
        given_local["links"].update({
            "config": "https://example.org/PyFunceble_config.yaml",
            "iana": "https://example.org/iana-db.json",
        })

        config_comparison = ConfigComparison(local_config=given_local,
                                             upstream_config=given_upstream)

        expected = False
        actual = config_comparison.is_local_identical()

        self.assertEqual(expected, actual)