Exemple #1
0
    def test_find_duplicative_names(self, unused_makedir):
        from letsencrypt.cli import _find_duplicative_certs
        test_cert = test_util.load_vector('cert-san.pem')
        with open(self.test_rc.cert, 'w') as f:
            f.write(test_cert)

        # No overlap at all
        result = _find_duplicative_certs(['wow.net', 'hooray.org'],
                                         self.config, self.cli_config)
        self.assertEqual(result, (None, None))

        # Totally identical
        result = _find_duplicative_certs(['example.com', 'www.example.com'],
                                         self.config, self.cli_config)
        self.assertTrue(result[0].configfile.filename.endswith('example.org.conf'))
        self.assertEqual(result[1], None)

        # Superset
        result = _find_duplicative_certs(['example.com', 'www.example.com',
                                          'something.new'], self.config,
                                         self.cli_config)
        self.assertEqual(result[0], None)
        self.assertTrue(result[1].configfile.filename.endswith('example.org.conf'))

        # Partial overlap doesn't count
        result = _find_duplicative_certs(['example.com', 'something.new'],
                                         self.config, self.cli_config)
        self.assertEqual(result, (None, None))
Exemple #2
0
    def test_find_duplicative_names(self, unused_makedir):
        from letsencrypt.cli import _find_duplicative_certs
        test_cert = test_util.load_vector('cert-san.pem')
        with open(self.test_rc.cert, 'w') as f:
            f.write(test_cert)

        # No overlap at all
        result = _find_duplicative_certs(self.cli_config,
                                         ['wow.net', 'hooray.org'])
        self.assertEqual(result, (None, None))

        # Totally identical
        result = _find_duplicative_certs(self.cli_config,
                                         ['example.com', 'www.example.com'])
        self.assertTrue(
            result[0].configfile.filename.endswith('example.org.conf'))
        self.assertEqual(result[1], None)

        # Superset
        result = _find_duplicative_certs(
            self.cli_config,
            ['example.com', 'www.example.com', 'something.new'])
        self.assertEqual(result[0], None)
        self.assertTrue(
            result[1].configfile.filename.endswith('example.org.conf'))

        # Partial overlap doesn't count
        result = _find_duplicative_certs(self.cli_config,
                                         ['example.com', 'something.new'])
        self.assertEqual(result, (None, None))
Exemple #3
0
    def test_find_duplicative_names(self):
        from letsencrypt.cli import _find_duplicative_certs
        test_cert = test_util.load_vector("cert-san.pem")
        with open(self.test_rc.cert, "w") as f:
            f.write(test_cert)

        # No overlap at all
        result = _find_duplicative_certs(["wow.net", "hooray.org"],
                                         self.config, self.cli_config)
        self.assertEqual(result, (None, None))

        # Totally identical
        result = _find_duplicative_certs(["example.com", "www.example.com"],
                                         self.config, self.cli_config)
        self.assertTrue(result[0].configfile.filename.endswith("example.org.conf"))
        self.assertEqual(result[1], None)

        # Superset
        result = _find_duplicative_certs(["example.com", "www.example.com",
                                          "something.new"], self.config,
                                         self.cli_config)
        self.assertEqual(result[0], None)
        self.assertTrue(result[1].configfile.filename.endswith("example.org.conf"))

        # Partial overlap doesn't count
        result = _find_duplicative_certs(["example.com", "something.new"],
                                         self.config, self.cli_config)
        self.assertEqual(result, (None, None))