Skip to content

Instantly share code, notes, and snippets.

@db0company
Created May 29, 2013 20:18
Show Gist options
  • Save db0company/5673494 to your computer and use it in GitHub Desktop.
Save db0company/5673494 to your computer and use it in GitHub Desktop.
## Get achievements without being logged in
## URL: http://paysdu42.fr:2048/api/v1/achievements?lang=en
## POST data:
## Content received:
{
"error": null,
"element": {
"server_size": 0,
"index": 0,
"limit": 10,
"items": []
}
}
## OCaml object generated:
[List]
Total items (server_size): 0
Index: 0
Limit: 10
Items:
Empty list
----> SUCCESS
## Get one user without login
## URL: http://paysdu42.fr:2048/api/v1/users/db0?lang=en
## POST data:
## Content received:
{
"error": null,
"element": {
"login": "db0",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a4afc8d6f58f7e2c000001",
"account_creation": "2013-05-28T13:23:20.767Z",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/db0",
"name": "Barbara Lepage",
"id": "51a4afc8d6f58f7e2c000001",
"avatar": null
}
}
## OCaml object generated:
(("51a4afc8d6f58f7e2c000001", 2458268.14252), "db0", "Barbara", "Lepage", 0, 1, 2453738, 0, "http://l.ohai.fr/user/db0", "en")
----> SUCCESS
## Create a new user
## URL: http://paysdu42.fr:2048/api/v1/users?lang=en
## POST data: lang=en&login=o87BF&email=Fh@gmail.com&password=helloworld&firstname=Barbara&lastname=Lepage&gender=female&birthday=1991-05-30
## Content received:
{
"error": null,
"element": {
"__v": 0,
"modification": "2013-05-29T20:09:45.933Z",
"login": "o87BF",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"creation": "2018-05-29T15:25:14Z",
"_id": "51a66089d1821c6e7b000023",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/o87bf",
"name": "Barbara Lepage",
"id": "51a66089d1821c6e7b000023",
"avatar": null
}
}
## OCaml object generated:
(("51a66089d1821c6e7b000023", 2458268.14252), "o87BF", "Barbara", "Lepage", 0, 1, 2453738, 0, "http://l.ohai.fr/user/o87bf", "en")
----> SUCCESS
## Get an authentication token using this user
## URL: http://paysdu42.fr:2048/api/v1/tokens
## POST data: login=o87BF&password=helloworld
## Content received:
{
"error": null,
"element": {
"__v": 0,
"modification": "2013-05-29T20:09:45.947Z",
"user": "51a66089d1821c6e7b000023",
"token": "o87BF-1109562642-1370462985946",
"expiration": "2013-06-05T20:09:45.946Z",
"creation": "2013-05-29T20:09:45.946Z",
"_id": "51a66089d1821c6e7b000024",
"id": "51a66089d1821c6e7b000024"
}
}
[Error]
Message: 2013-06-05T20:09:45.946Z does not match the format %Y-%m-%dT%H:%M:%SZ
Type: CLIENT_InvalidArgument
Code: -4
----> FAILURE
## Add an achievement
## URL: http://paysdu42.fr:2048/api/v1/achievements
## POST data: name=rFIPt&description=ZNGJpTNHjE
## Content received:
{
"error": {
"code": 6010,
"type": "AuthenticationError",
"message": "Authentication error"
},
"element": null
}
[Error]
Message: Authentication error
Type: AuthenticationError
Code: 6010
----> FAILURE
## Get users
## URL: http://paysdu42.fr:2048/api/v1/users?limit=2&term=a
## POST data:
## Content received:
{
"error": null,
"element": {
"server_size": 56,
"index": 0,
"limit": "2",
"items": [
{
"login": "db0",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a4afc8d6f58f7e2c000001",
"account_creation": "2013-05-28T13:23:20.767Z",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/db0",
"name": "Barbara Lepage",
"id": "51a4afc8d6f58f7e2c000001",
"avatar": null
},
{
"login": "YlGxb",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a4b72c9643dfce2c000003",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/ylgxb",
"name": "Barbara Lepage",
"id": "51a4b72c9643dfce2c000003",
"avatar": null
}
]
}
}
[Error]
Message: The JSON tree response is not formatted as expected: Expected int, got string
"2"
Type: CLIENT_InvalidJSON
Code: -18
----> FAILURE
## Get one user
## URL: http://paysdu42.fr:2048/api/v1/users/o87BF
## POST data:
## Content received:
{
"error": null,
"element": {
"modification": "2013-05-29T20:09:45.933Z",
"login": "o87BF",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a66089d1821c6e7b000023",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/o87bf",
"name": "Barbara Lepage",
"id": "51a66089d1821c6e7b000023",
"avatar": null
}
}
## OCaml object generated:
(("51a66089d1821c6e7b000023", 2458268.14252), "o87BF", "Barbara", "Lepage", 0, 1, 2453738, 0, "http://l.ohai.fr/user/o87bf", "en")
----> SUCCESS
## Delete a user (myself)
## URL: http://paysdu42.fr:2048/api/v1/users/o87BF
## POST data:
## Content received:
Cannot DELETE /api/v1/users/o87BF
[Error]
Message: The JSON tree response is not formatted as expected: Line 1, bytes 2-33:
Invalid token 'Cannot DELETE /api/v1/users/o87BF'
Type: CLIENT_InvalidJSON
Code: -18
----> FAILURE
## Get the user I just deleted (should fail because the auth token should not exists anymore)
## URL: http://paysdu42.fr:2048/api/v1/users/o87BF
## POST data:
## Content received:
{
"error": null,
"element": {
"modification": "2013-05-29T20:09:45.933Z",
"login": "o87BF",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a66089d1821c6e7b000023",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/o87bf",
"name": "Barbara Lepage",
"id": "51a66089d1821c6e7b000023",
"avatar": null
}
}
## OCaml object generated:
(("51a66089d1821c6e7b000023", 2458268.14252), "o87BF", "Barbara", "Lepage", 0, 1, 2453738, 0, "http://l.ohai.fr/user/o87bf", "en")
----> SUCCESS
End of auth test
## Get the user I just deleted (should fail because the user does not exists anymore)
## URL: http://paysdu42.fr:2048/api/v1/users/o87BF?lang=en
## POST data:
## Content received:
{
"error": null,
"element": {
"modification": "2013-05-29T20:09:45.933Z",
"login": "o87BF",
"firstname": "Barbara",
"lastname": "Lepage",
"gender": "female",
"lang": "en",
"birthday": "2006-01-02",
"_id": "51a66089d1821c6e7b000023",
"__v": 0,
"creation": "2018-05-29T15:25:14Z",
"friends": [],
"achievements": [],
"profile_url": "http://l.ohai.fr/user/o87bf",
"name": "Barbara Lepage",
"id": "51a66089d1821c6e7b000023",
"avatar": null
}
}
## OCaml object generated:
(("51a66089d1821c6e7b000023", 2458268.14252), "o87BF", "Barbara", "Lepage", 0, 1, 2453738, 0, "http://l.ohai.fr/user/o87bf", "en")
----> SUCCESS
## END
####################################################
T O T A L
Success : 4 / 10
Failure : 6 / 10
####################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment