Example #1
0
    def test_upgrade(self):
        # Test
        report = feed_certs.upgrade(self.v1_test_db.database, self.tmp_test_db.database)

        # Verify
        self.assertTrue(report is not None)
        self.assertTrue(report.success)

        all_repo_importers = self.tmp_test_db.database.repo_importers.find({})
        self.assertTrue(all_repo_importers.count() > 0)
        for repo_importer in all_repo_importers:
            importer_working_dir = repos.importer_working_dir(repo_importer['importer_type_id'],
                                                              repo_importer['repo_id'],
                                                              mkdir=False)

            expected_cert_path = os.path.join(importer_working_dir, 'ssl_ca_cert')
            self.assertTrue(os.path.exists(expected_cert_path))
            self._assert_contents(expected_cert_path, repo_importer['config']['ssl_ca_cert'])

            expected_cert_path = os.path.join(importer_working_dir, 'ssl_client_cert')
            self.assertTrue(os.path.exists(expected_cert_path))
            self._assert_contents(expected_cert_path, repo_importer['config']['ssl_client_cert'])
Example #2
0
    def test_upgrade(self):
        # Test
        report = feed_certs.upgrade(self.v1_test_db.database, self.tmp_test_db.database)

        # Verify
        self.assertTrue(report is not None)
        self.assertTrue(report.success)

        # Primarily, the upgrade shouldn't error if the repo doesn't contain certs. Also
        # check to make sure it's not writing cert files anyway.

        all_repo_importers = self.tmp_test_db.database.repo_importers.find({})
        self.assertTrue(all_repo_importers.count() > 0)
        for repo_importer in all_repo_importers:
            importer_working_dir = repos.importer_working_dir(repo_importer['importer_type_id'],
                                                              repo_importer['repo_id'],
                                                              mkdir=False)

            expected_cert_path = os.path.join(importer_working_dir, 'ssl_ca_cert')
            self.assertTrue(not os.path.exists(expected_cert_path))

            expected_cert_path = os.path.join(importer_working_dir, 'ssl_client_cert')
            self.assertTrue(not os.path.exists(expected_cert_path))