コード例 #1
0
ファイル: base_db_upgrade.py プロジェクト: tomlanyon/pulp
class BaseDbUpgradeTests(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        unittest.TestCase.setUpClass()
#        configure_for_non_unit_test_db()

    def setUp(self):
        super(BaseDbUpgradeTests, self).setUp()

        self.v1_db_name = 'pulp_upgrade_unit'
        self.tmp_db_name = 'pulp_upgrade_unit_tmp'
        db_file = DB_FILE_PATH

        self.v1_test_db = PulpTestDatabase(self.v1_db_name)
        self.v1_test_db.delete()
        self.v1_test_db.load_from_file(db_file)

        self.tmp_test_db = PulpTestDatabase(self.tmp_db_name)
        self.tmp_test_db.delete()

    def tearDown(self):
        super(BaseDbUpgradeTests, self).tearDown()

        self.v1_test_db.delete()
        self.tmp_test_db.delete()
コード例 #2
0
    def setUp(self):
        super(BaseFileUpgradeTests, self).setUp()

        self.v1_db_name = 'pulp_upgrade_unit_fs'
        self.v2_db_name = 'pulp_upgrade_unit_fs_tmp'

        self.v1_test_db = PulpTestDatabase(self.v1_db_name)
        self.v1_test_db.load_from_file(V1_DB_FILE_PATH)

        self.v2_test_db = PulpTestDatabase(self.v2_db_name)
コード例 #3
0
ファイル: base_db_upgrade.py プロジェクト: tomlanyon/pulp
    def setUp(self):
        super(BaseDbUpgradeTests, self).setUp()

        self.v1_db_name = 'pulp_upgrade_unit'
        self.tmp_db_name = 'pulp_upgrade_unit_tmp'
        db_file = DB_FILE_PATH

        self.v1_test_db = PulpTestDatabase(self.v1_db_name)
        self.v1_test_db.delete()
        self.v1_test_db.load_from_file(db_file)

        self.tmp_test_db = PulpTestDatabase(self.tmp_db_name)
        self.tmp_test_db.delete()
コード例 #4
0
class BaseFileUpgradeTests(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        # take a backup of filesystem data
        shutil.copytree(V1_TEST_FILESYSTEM, '/tmp/pulp/v1')

    @classmethod
    def tearDownClass(cls):
        shutil.rmtree('/tmp/pulp/v1')

    def setUp(self):
        super(BaseFileUpgradeTests, self).setUp()

        self.v1_db_name = 'pulp_upgrade_unit_fs'
        self.v2_db_name = 'pulp_upgrade_unit_fs_tmp'

        self.v1_test_db = PulpTestDatabase(self.v1_db_name)
        self.v1_test_db.load_from_file(V1_DB_FILE_PATH)

        self.v2_test_db = PulpTestDatabase(self.v2_db_name)

    def tearDown(self):
        super(BaseFileUpgradeTests, self).tearDown()
        self.v1_test_db.delete()
        self.v2_test_db.delete()
コード例 #5
0
ファイル: test_db_loader.py プロジェクト: tomlanyon/pulp
    def test_load_delete(self):
        # Setup
        db_file = os.path.join(DB_DIR, 'unit_test.tar.gz')
        db_name = 'pulp_upgrade_unit'

        # Test - Load
        test_db = PulpTestDatabase(db_name)
        test_db.load_from_file(db_file)

        # Verify - Load
        db = test_db.database
        self.assertTrue('repos' in db.collection_names())

        # Test - Delete
        test_db.delete()

        # Verify - Delete
        conn = pymongo.Connection()
        self.assertTrue(db_name not in conn.database_names())