summaryrefslogtreecommitdiff
path: root/yarns/000.yarn
blob: 9bd04322680e4a4b0bf75a3a085bc205e94f6cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Effiapi test suite
author: Lars Wirzenius
...

# Test scenarios

This chapter descibes the effiapi API, as a [yarn][] automated
scenario test. It is meant to be understandable to Effi sysadmins, as
well as be an executable test suite for the API.

The API is a simple RESTful HTTP API using JSON. This means that:

* each API call is an HTTP request, with a response

* all data is represented as JSON in the body of the request of
  response

* metadata about the data is represeneted as HTTP headers

* standard HTTP verbs (POST, PUT, GET, DELETE) are used to indicate
  the action

* standard HTTP status codes are used to indicate result of the
  request (200 = OK, 404 = not found, etc)

## Manage memberships

This section shows the API calls to manage a memberhip: to create the
member, to update and retrieve it, and to search memberships.

~~~
SCENARIO Manage memberships

GIVEN An effiapi instance
WHEN admin requests POST /memb with body { "fullname": "James Bond" }
THEN the member id is ID

WHEN admin requests GET /memb with header Muck-Id: ${ID}
THEN HTTP status 200
AND HTTP body matches { "fullname": "James Bond" }
~~~

TODO:

* update
* delete
* search
* members can see their own data, and can't see each others'
* member follows authn link emailed to them

# Appendix: Yarn scenario step implementations