Пример #1
0
 def get_all_by_host(cls, context, host):
     backups = db.backup_get_all_by_host(context, host)
     expected_attrs = Backup._get_expected_attrs(context)
     return base.obj_make_list(context,
                               cls(context),
                               objects.Backup,
                               backups,
                               expected_attrs=expected_attrs)
Пример #2
0
    def test_backup_get_all_by_host_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_host(self.ctxt, 'testhost')
        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_host(self.ctxt, 'testhost')
        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_host(ctxt_read_deleted, 'testhost')
        self.assertEqual(len(backups), 2)
Пример #3
0
    def test_backup_get_all_by_host_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_host(self.ctxt, 'testhost')
        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_host(self.ctxt, 'testhost')
        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_host(ctxt_read_deleted, 'testhost')
        self.assertEqual(len(backups), 2)
Пример #4
0
 def get_all_by_host(cls, context: context.RequestContext,
                     host: str) -> 'BackupList':
     backups = db.backup_get_all_by_host(context, host)
     expected_attrs = Backup._get_expected_attrs(context)
     return base.obj_make_list(context,
                               cls(context),
                               objects.Backup,
                               backups,
                               expected_attrs=expected_attrs)
Пример #5
0
    def test_backup_get_all_by_host_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_host(self.ctxt, "testhost")
        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_host(self.ctxt, "testhost")
        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_host(ctxt_read_deleted, "testhost")
        self.assertEqual(2, len(backups))
Пример #6
0
 def get_all_by_host(cls, context, host):
     backups = db.backup_get_all_by_host(context, host)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups)
Пример #7
0
 def test_backup_get_all_by_host(self):
     byhost = db.backup_get_all_by_host(self.ctxt, self.created[1]['host'])
     self._assertEqualObjects(self.created[1], byhost[0])
Пример #8
0
 def test_backup_get_all_by_host(self):
     byhost = db.backup_get_all_by_host(self.ctxt,
                                        self.created[1]['host'])
     self._assertEqualObjects(self.created[1], byhost[0])
Пример #9
0
 def get_all_by_host(cls, context, host):
     backups = db.backup_get_all_by_host(context, host)
     expected_attrs = Backup._get_expected_attrs(context)
     return base.obj_make_list(context, cls(context), objects.Backup,
                               backups, expected_attrs=expected_attrs)