示例#1
0
    def test_list_backup(self):
        backups = db.backup_get_all_by_project(self.ctxt, 'project1')
        self.assertEqual(0, len(backups))

        b2 = self._create_backup_db_entry(project_id='project1')
        backups = db.backup_get_all_by_project(self.ctxt, 'project1')
        self.assertEqual(1, len(backups))
        self.assertEqual(b2, backups[0].id)
示例#2
0
    def test_list_backup(self):
        backups = db.backup_get_all_by_project(self.ctxt, 'project1')
        self.assertEqual(len(backups), 0)

        b1 = self._create_backup_db_entry()
        b2 = self._create_backup_db_entry(project_id='project1')
        backups = db.backup_get_all_by_project(self.ctxt, 'project1')
        self.assertEqual(len(backups), 1)
        self.assertEqual(backups[0].id, b2)
示例#3
0
 def get_all_by_project(
     cls, context, project_id, filters=None, marker=None, limit=None, offset=None, sort_keys=None, sort_dirs=None
 ):
     backups = db.backup_get_all_by_project(
         context, project_id, filters, marker, limit, offset, sort_keys, sort_dirs
     )
     return base.obj_make_list(context, cls(context), objects.Backup, backups)
示例#4
0
    def test_backup_get_all_by_project_with_deleted(self):
        """Test deleted backups don't show up in backup_get_all_by_project.
           Unless context.read_deleted is 'yes'"""
        backups = db.backup_get_all_by_project(self.ctxt, 'fake')
        self.assertEqual(len(backups), 0)

        backup_id_keep = self._create_backup_db_entry()
        backup_id = self._create_backup_db_entry()
        db.backup_destroy(self.ctxt, backup_id)

        backups = db.backup_get_all_by_project(self.ctxt, 'fake')
        self.assertEqual(len(backups), 1)
        self.assertEqual(backups[0].id, backup_id_keep)

        ctxt_read_deleted = context.get_admin_context('yes')
        backups = db.backup_get_all_by_project(ctxt_read_deleted, 'fake')
        self.assertEqual(len(backups), 2)
示例#5
0
 def get_all_by_project(cls, context, project_id, filters=None,
                        marker=None, limit=None, offset=None,
                        sort_keys=None, sort_dirs=None):
     backups = db.backup_get_all_by_project(context, project_id, filters,
                                            marker, limit, offset,
                                            sort_keys, sort_dirs)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups)
示例#6
0
    def test_backup_get_all_by_project_with_deleted(self):
        """Test deleted backups don't show up in backup_get_all_by_project.
           Unless context.read_deleted is 'yes'"""
        backups = db.backup_get_all_by_project(self.ctxt, 'fake')
        self.assertEqual(len(backups), 0)

        backup_id_keep = self._create_backup_db_entry()
        backup_id = self._create_backup_db_entry()
        db.backup_destroy(self.ctxt, backup_id)

        backups = db.backup_get_all_by_project(self.ctxt, 'fake')
        self.assertEqual(len(backups), 1)
        self.assertEqual(backups[0].id, backup_id_keep)

        ctxt_read_deleted = context.get_admin_context('yes')
        backups = db.backup_get_all_by_project(ctxt_read_deleted, 'fake')
        self.assertEqual(len(backups), 2)
示例#7
0
    def test_backup_get_all_by_project_with_deleted(self):
        """Test deleted backups.

        Test deleted backups don't show up in backup_get_all_by_project.
        Unless context.read_deleted is 'yes'.
        """
        backups = db.backup_get_all_by_project(self.ctxt, "fake")
        self.assertEqual(0, len(backups))

        backup_keep = self._create_backup_db_entry()
        backup = self._create_backup_db_entry()
        db.backup_destroy(self.ctxt, backup.id)

        backups = db.backup_get_all_by_project(self.ctxt, "fake")
        self.assertEqual(1, len(backups))
        self.assertEqual(backup_keep.id, backups[0].id)

        ctxt_read_deleted = context.get_admin_context("yes")
        backups = db.backup_get_all_by_project(ctxt_read_deleted, "fake")
        self.assertEqual(2, len(backups))
示例#8
0
 def get_all_by_project(cls, context, project_id, filters=None):
     backups = db.backup_get_all_by_project(context, project_id, filters)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups)
示例#9
0
 def test_backup_get_all_by_project(self):
     byproj = db.backup_get_all_by_project(self.ctxt,
                                           self.created[1]['project_id'])
     self._assertEqualObjects(self.created[1], byproj[0])
示例#10
0
 def test_backup_get_all_by_project(self):
     byproj = db.backup_get_all_by_project(self.ctxt,
                                           self.created[1]['project_id'])
     self._assertEqualObjects(self.created[1], byproj[0])