{
  "id": "RB-002",
  "name": "List recycle-bin rows in mine scope",
  "description": "Listing the recycle bin in mine scope should return rows owned by the current caller and expose the server-owned scope capability flags.",
  "scene": "recycle_bin",
  "object": "RecycleBin",
  "method": "GET",
  "endpoint": "/services/data/v63.0/recyclebin?scope=mine",
  "setup": [
    {
      "name": "Create soft-deleted Account for recycle-bin list",
      "type": "sql",
      "sql": "INSERT INTO Account (Id, Name, IsDeleted) VALUES ('001RB002', 'Recycle List Account', 1) ON DUPLICATE KEY UPDATE Name=VALUES(Name), IsDeleted=VALUES(IsDeleted)",
      "id_var": "seed_account_id",
      "id_value": "001RB002",
      "object": "Account"
    },
    {
      "name": "Create caller-owned recycle-bin entry",
      "type": "sql",
      "sql": "INSERT INTO _System_RecycleBin (Id, RecordId, ObjectApiName, RecordName, DeletedBy, DeletedDate, CreatedDate, LastModifiedDate) VALUES ('rb-002-entry', '001RB002', 'Account', 'Recycle List Account', '10000000-0000-0000-0000-000000000001', NOW(), NOW(), NOW()) ON DUPLICATE KEY UPDATE RecordId=VALUES(RecordId), ObjectApiName=VALUES(ObjectApiName), RecordName=VALUES(RecordName), DeletedBy=VALUES(DeletedBy), DeletedDate=VALUES(DeletedDate), LastModifiedDate=VALUES(LastModifiedDate)",
      "id_var": "recycle_bin_entry_id",
      "id_value": "rb-002-entry",
      "object": "_System_RecycleBin"
    }
  ],
  "expects": {
    "status_code": 200
  },
  "response_assertions": [
    {
      "field": "scope",
      "operator": "eq",
      "value": "mine"
    },
    {
      "field": "records.0.Id",
      "operator": "eq",
      "value": "rb-002-entry"
    },
    {
      "field": "records.0.RecordId",
      "operator": "eq",
      "value": "001RB002"
    },
    {
      "field": "canViewOrgScope",
      "operator": "eq",
      "value": true
    }
  ],
  "teardown": [
    {
      "type": "sql",
      "sql": "DELETE FROM _System_RecycleBin WHERE Id = 'rb-002-entry'"
    },
    {
      "type": "sql",
      "sql": "DELETE FROM Account WHERE Id = '001RB002'"
    }
  ],
  "priority": "P1"
}
