Пример #1
0
    def setUp(self):
        super(NoFeedCertificateTests, self).setUp()

        # This script occurs after the DB is upgraded, so simulate the
        # necessary preconditions
        yum_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
        iso_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
        all_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)

        # This script also relies on the working directories to be created
        self.tmp_dir = tempfile.mkdtemp(prefix='no-feeds-fs-unit-test')
        repos.WORKING_DIR_ROOT = self.tmp_dir
        repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
Пример #2
0
    def test_upgrade(self):
        # Test
        report = repos.upgrade(self.v1_test_db.database,
                               self.tmp_test_db.database)

        # Verify
        self.assertTrue(report.success)

        all_repos = self.tmp_test_db.database.repos.find({})
        self.assertTrue(all_repos.count() > 0)
        for r in all_repos:
            working_dir = repos.repository_working_dir(r['id'], mkdir=False)
            self.assertTrue(os.path.exists(working_dir),
                            msg='Missing: %s' % working_dir)

        repo_importers = self.tmp_test_db.database.repo_importers.find({})
        self.assertTrue(repo_importers.count() > 0)
        for i in repo_importers:
            working_dir = repos.importer_working_dir(i['importer_type_id'],
                                                     i['repo_id'],
                                                     mkdir=False)
            self.assertTrue(os.path.exists(working_dir),
                            msg='Missing: %s' % working_dir)

        repo_distributors = self.tmp_test_db.database.repo_distributors.find(
            {})
        self.assertTrue(repo_distributors.count() > 0)
        for d in repo_distributors:
            working_dir = repos.distributor_working_dir(
                d['distributor_type_id'], d['repo_id'], mkdir=False)
            self.assertTrue(os.path.exists(working_dir),
                            msg='Missing: %s' % working_dir)
Пример #3
0
    def setUp(self):
        super(FeedCertificateTests, self).setUp()

        # Munge each repo to point to a sample cert and CA
        ca_cert_path = os.path.join(DATA_DIR, 'repo_related_files', 'feed_ca.crt')
        client_cert_path = os.path.join(DATA_DIR, 'repo_related_files', 'feed_cert.crt')

        v1_repos = self.v1_test_db.database.repos.find()
        for v1_repo in v1_repos:
            v1_repo['feed_ca'] = ca_cert_path
            v1_repo['feed_cert'] = client_cert_path
            self.v1_test_db.database.repos.save(v1_repo)

        # This script occurs after the DB is upgraded, so simulate the
        # necessary preconditions
        yum_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
        iso_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
        all_repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)

        # This script also relies on the working directories to be created
        self.tmp_dir = tempfile.mkdtemp(prefix='feeds-fs-unit-test')
        repos.WORKING_DIR_ROOT = self.tmp_dir
        repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)
Пример #4
0
    def test_upgrade(self):
        # Test
        report = repos.upgrade(self.v1_test_db.database, self.tmp_test_db.database)

        # Verify
        self.assertTrue(report.success)

        all_repos = self.tmp_test_db.database.repos.find({})
        self.assertTrue(all_repos.count() > 0)
        for r in all_repos:
            working_dir = repos.repository_working_dir(r['id'], mkdir=False)
            self.assertTrue(os.path.exists(working_dir), msg='Missing: %s' % working_dir)

        repo_importers = self.tmp_test_db.database.repo_importers.find({})
        self.assertTrue(repo_importers.count() > 0)
        for i in repo_importers:
            working_dir = repos.importer_working_dir(i['importer_type_id'], i['repo_id'], mkdir=False)
            self.assertTrue(os.path.exists(working_dir), msg='Missing: %s' % working_dir)

        repo_distributors = self.tmp_test_db.database.repo_distributors.find({})
        self.assertTrue(repo_distributors.count() > 0)
        for d in repo_distributors:
            working_dir = repos.distributor_working_dir(d['distributor_type_id'], d['repo_id'], mkdir=False)
            self.assertTrue(os.path.exists(working_dir), msg='Missing: %s' % working_dir)