'Test deleted backups.
Test deleted backups don\'t show up in backup_get_all_by_project.
Unless context.read_deleted is \'yes\'.'

def test_backup_get_all_by_project_with_deleted(self):

    project_id = str(uuid.uuid4())
    backups = db.backup_get_all_by_project(self.ctxt, project_id)
    self.assertEqual(0, len(backups))
    backup_keep = self._create_backup_db_entry(project_id=project_id)
    backup = self._create_backup_db_entry(project_id=project_id)
    db.backup_destroy(self.ctxt, backup.id)
    backups = db.backup_get_all_by_project(self.ctxt, project_id)
    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, project_id)
    self.assertEqual(2, len(backups))
