Esempio n. 1
0
    def setUp(self):
        super(GuestAgentCouchDBManagerTest, self).setUp()
        self.real_status = couchdb_service.CouchDBAppStatus.set_status

        class FakeInstanceServiceStatus(object):
            status = ServiceStatuses.NEW

            def save(self):
                pass

        couchdb_service.CouchDBAppStatus.set_status = MagicMock(
            return_value=FakeInstanceServiceStatus())
        self.context = trove_testtools.TroveTestContext(self)
        self.manager = couchdb_manager.Manager()
        self.pkg = couchdb_service.packager
        self.real_db_app_status = couchdb_service.CouchDBAppStatus
        self.origin_os_path_exists = os.path.exists
        self.origin_format = volume.VolumeDevice.format
        self.origin_migrate_data = volume.VolumeDevice.migrate_data
        self.origin_mount = volume.VolumeDevice.mount
        self.origin_mount_points = volume.VolumeDevice.mount_points
        self.origin_stop_db = couchdb_service.CouchDBApp.stop_db
        self.origin_start_db = couchdb_service.CouchDBApp.start_db
        self.original_get_ip = netutils.get_my_ipv4
        self.orig_make_host_reachable = (
            couchdb_service.CouchDBApp.make_host_reachable)
    def setUp(self):
        super(GuestAgentCouchDBManagerTest, self).setUp()
        self.real_status = couchdb_service.CouchDBAppStatus.set_status

        class FakeInstanceServiceStatus(object):
            status = ServiceStatuses.NEW

            def save(self):
                pass

        couchdb_service.CouchDBAppStatus.set_status = MagicMock(
            return_value=FakeInstanceServiceStatus())
        self.context = trove_testtools.TroveTestContext(self)
        self.manager = couchdb_manager.Manager()
        self.pkg = couchdb_service.packager
        self.real_db_app_status = couchdb_service.CouchDBAppStatus
        self.origin_os_path_exists = os.path.exists
        self.origin_format = volume.VolumeDevice.format
        self.origin_migrate_data = volume.VolumeDevice.migrate_data
        self.origin_mount = volume.VolumeDevice.mount
        self.origin_mount_points = volume.VolumeDevice.mount_points
        self.origin_stop_db = couchdb_service.CouchDBApp.stop_db
        self.origin_start_db = couchdb_service.CouchDBApp.start_db
        self.original_get_ip = netutils.get_my_ipv4
        self.orig_make_host_reachable = (
            couchdb_service.CouchDBApp.make_host_reachable)
        self.orig_backup_restore = backup.restore
        self.orig_create_users = couchdb_service.CouchDBAdmin.create_user
        self.orig_delete_user = couchdb_service.CouchDBAdmin.delete_user
        self.orig_list_users = couchdb_service.CouchDBAdmin.list_users
        self.orig_get_user = couchdb_service.CouchDBAdmin.get_user
        self.orig_grant_access = couchdb_service.CouchDBAdmin.grant_access
        self.orig_revoke_access = couchdb_service.CouchDBAdmin.revoke_access
        self.orig_list_access = couchdb_service.CouchDBAdmin.list_access
        self.orig_enable_root = couchdb_service.CouchDBAdmin.enable_root
        self.orig_is_root_enabled = (
            couchdb_service.CouchDBAdmin.is_root_enabled)
        self.orig_create_databases = (
            couchdb_service.CouchDBAdmin.create_database)
        self.orig_list_databases = couchdb_service.CouchDBAdmin.list_databases
        self.orig_delete_database = (
            couchdb_service.CouchDBAdmin.delete_database)