// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`#users.activate should activate a suspended user 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "isViewer": false,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": true,
        "promote": true,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.activate should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.delete should require authentication 1`] = `
Object {
  "error": "authentication_required",
  "message": "Authentication required",
  "ok": false,
  "status": 401,
}
`;

exports[`#users.demote should demote an admin 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "isViewer": false,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": true,
        "promote": true,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.demote should demote an admin to member 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "isViewer": false,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": true,
        "promote": true,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.demote should demote an admin to viewer 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "isViewer": true,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": true,
        "promote": true,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.demote should not allow demoting self 1`] = `
Object {
  "error": "validation_error",
  "message": "Unable to demote the current user",
  "ok": false,
  "status": 400,
}
`;

exports[`#users.demote should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.promote should promote a new admin 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": true,
    "isSuspended": false,
    "isViewer": false,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": true,
        "promote": false,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.promote should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.suspend should not allow suspending the user themselves 1`] = `
Object {
  "error": "validation_error",
  "message": "Unable to suspend the current user",
  "ok": false,
  "status": 400,
}
`;

exports[`#users.suspend should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.suspend should suspend an user 1`] = `
Object {
  "data": Object {
    "avatarUrl": null,
    "color": "#e600e0",
    "createdAt": "2018-01-02T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": true,
    "isViewer": false,
    "language": "en_US",
    "lastActiveAt": null,
    "name": "User 1",
    "preferences": null,
    "updatedAt": "2018-01-02T00:00:00.000Z",
  },
  "ok": true,
  "policies": Array [
    Object {
      "abilities": Object {
        "activate": true,
        "delete": true,
        "demote": false,
        "promote": false,
        "read": true,
        "readDetails": true,
        "resendInvite": true,
        "suspend": true,
        "update": false,
      },
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    },
  ],
  "status": 200,
}
`;

exports[`#users.update should require authentication 1`] = `
Object {
  "error": "authentication_required",
  "message": "Authentication required",
  "ok": false,
  "status": 401,
}
`;
