Skip to content

Instantly share code, notes, and snippets.

@foeken
Created December 20, 2010 17:57
Show Gist options
  • Save foeken/748717 to your computer and use it in GitHub Desktop.
Save foeken/748717 to your computer and use it in GitHub Desktop.
Feature: Accessing the people api
As an API client
In order to do things with people
I want to access the people api
Background:
Given a client application named "Ons Medewerkersportaal"
And "Ons Medewerkersportaal" is allowed to use xAuth
And an account "Andre" with email "andre.foeken@nedap.com"
And an account "Ria" with email "ria.foeken@nedap.com"
And an account "Oscar" with email "oscar.foeken@nedap.com"
And "Andre" has a sharing relationship with "Ria"
And "Andre" has a sharing relationship with "Oscar"
And "Andre" receives care
Scenario: Retrieve a list of people in a first and second degree network
When "Oscar" authorizes "Ons Medewerkersportaal" using xAuth
Given I send and accept XML
When I send a GET request for "/api/people.xml"
Then the response should be "200"
And the XML response should be a "people" array with 3 "person" elements
# Everyone should have these
And the XML response content of "//people/person/first-name" should be "Andre, Oscar, Ria"
# Only first degree should have these
And the XML response content of "//people/person/time-zone" should have 2 values
# Only the current person should have this!
And the XML response content of "//people/person/receives-care" should have 1 value
Scenario: Retrieve myself
When "Oscar" authorizes "Ons Medewerkersportaal" using xAuth
Given I send and accept XML
When I send a GET request for "/api/people/[Person:Oscar].xml"
Then the response should be "200"
And the XML response should be the following within "//person":
| Id | * |
| Owner id | * |
| First name | Oscar |
| Last name | * |
| Male | * |
| Email | * |
| Date of Birth | * |
| Photo | * |
| Bio | * |
| Time zone | Europe/Amsterdam |
| Account | true |
| Me | true |
| Receives care | false |
| Created at | * |
| Updated at | * |
| Event reminders via email enabled | * |
| Event reminders via phone enabled | * |
| Message notifications via email enabled | * |
| Message notifications via phone enabled | * |
Scenario: Retrieve a person in your first degree network
When "Oscar" authorizes "Ons Medewerkersportaal" using xAuth
Given I send and accept XML
When I send a GET request for "/api/people/[Person:Andre].xml"
Then the response should be "200"
And the XML response should be the following within "//person":
| Id | * |
| Owner id | * |
| First name | Andre |
| Last name | * |
| Male | * |
| Email | * |
| Date of Birth | * |
| Photo | * |
| Bio | * |
| Time zone | Europe/Amsterdam |
| Account | true |
| Me | false |
| Created at | * |
| Updated at | * |
Scenario: Retrieve a person in your second degree network
When "Oscar" authorizes "Ons Medewerkersportaal" using xAuth
Given I send and accept XML
When I send a GET request for "/api/people/[Person:Ria].xml"
Then the response should be "200"
And the XML response should be the following within "//person":
| Id | * |
| First name | Ria |
| Last name | * |
| Male | * |
| Email | * |
| Photo | * |
| Me | false |
| Created at | * |
| Updated at | * |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment