-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added hurl test for testing post route for JSON fragment
- Loading branch information
1 parent
d1168ab
commit 65bb739
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# tests/integration/post-fragments-json.hurl | ||
POST http://localhost:8080/v1/fragments | ||
Content-Type: application/json | ||
[BasicAuth] | ||
[email protected]:password1 | ||
#Authorization: Basic dXNlcjFAZW1haWwuY29tOnBhc3N3b3JkMQ== | ||
```json | ||
{"name": "harshil"} | ||
``` | ||
|
||
HTTP/1.1 201 | ||
[Asserts] | ||
header "Location" matches /^http:\/\/localhost:8080\/v1\/fragments\/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/ | ||
jsonpath "$.status" == "ok" | ||
jsonpath "$.fragment.id" matches /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/ | ||
jsonpath "$.fragment.ownerId" matches /^[0-9a-fA-F]+$/ | ||
jsonpath "$.fragment.created" isString | ||
jsonpath "$.fragment.updated" isString | ||
jsonpath "$.fragment.type" == "application/json" | ||
# 19 is the length of our fragment data: 'This is a fragment!' | ||
jsonpath "$.fragment.size" == 20 | ||
# Capture the location header | ||
[Captures] | ||
uri: header "Location" | ||
|
||
# 2. Try to the get the above posted fragment by using uri. | ||
GET {{uri}} | ||
[BasicAuth] | ||
[email protected]:password1 | ||
|
||
HTTP/1.1 200 | ||
Content-Type: application/json; charset=utf-8 | ||
Content-Length: 20 | ||
[Asserts] | ||
```json | ||
{"name": "harshil"} | ||
``` |