-
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.
- Loading branch information
1 parent
2ca8fdf
commit 4af64f6
Showing
7 changed files
with
138 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 @@ | ||
hurl.vars |
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,41 @@ | ||
# HURL | ||
|
||
Use hurl to test an API. | ||
|
||
TODO: | ||
|
||
* Is there a way to introduce delays in chained requests? | ||
* Exporting captured values to environment variables | ||
|
||
## Install | ||
|
||
```sh | ||
brew install hurl | ||
|
||
hurl --help | ||
``` | ||
|
||
## Run scripts | ||
|
||
First you'll need to create the `hurl.vars` file from the template. | ||
|
||
```sh | ||
# Start a realtime. | ||
hurl --very-verbose --test trint-realtime.hurl --variables-file ./hurl.vars | ||
|
||
|
||
|
||
hurl --very-verbose --test trint-realtime-start.hurl --variables-file ./hurl.vars | ||
|
||
hurl --very-verbose --test trint-realtime-status.hurl --variables-file ./hurl.vars --variable trintid=AIn0AosISr2G3u0gY-eP6Q | ||
|
||
hurl --very-verbose --test trint-realtime-stop.hurl --variables-file ./hurl.vars --variable trintid=AIn0AosISr2G3u0gY-eP6Q | ||
|
||
|
||
``` | ||
|
||
## Resources | ||
|
||
* [hurl.dev](https://hurl.dev/) | ||
* Orange-OpenSource/hurl repo [here](https://github.com/Orange-OpenSource/hurl) | ||
* The Trint API Developer Hub [here](https://dev.trint.com/) |
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,4 @@ | ||
apikey=xxxxx | ||
webapp=https://app.trint.com/ | ||
base_api=https://api.trint.com | ||
base_upload_api=https://upload.trint.com |
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,22 @@ | ||
# Start a realtime | ||
PUT {{ base_api }}/transcripts/realtime | ||
Accept: application/json | ||
Content-Type: application/json | ||
api-key: {{ apikey }} | ||
{ | ||
"language": "en", | ||
"streamUrl": "https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index_1M.m3u8", | ||
"transcriptDelay":"5", | ||
"title": "hurl test" | ||
} | ||
|
||
HTTP 200 | ||
[Captures] | ||
trintid: jsonpath "$._id" | ||
|
||
[Asserts] | ||
header "Content-Type" == "application/json" | ||
jsonpath "$._id" exists | ||
|
||
|
||
|
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,16 @@ | ||
# Status for a realtime | ||
GET {{ base_api }}/transcripts/realtime/{{trintid}} | ||
Accept: application/json | ||
Content-Type: application/json | ||
api-key: {{ apikey }} | ||
|
||
HTTP 200 | ||
[Asserts] | ||
header "Content-Type" == "application/json" | ||
jsonpath "$.status" exists | ||
jsonpath "$.started" exists | ||
jsonpath "$.expires" exists | ||
jsonpath "$.status" == "TRANSCRIBING" | ||
|
||
|
||
|
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,16 @@ | ||
# Stop a realtime | ||
DELETE {{ base_api }}/transcripts/realtime | ||
Accept: application/json | ||
Content-Type: application/json | ||
api-key: {{ apikey }} | ||
{ | ||
"trintId": "{{ trintid }}" | ||
} | ||
|
||
HTTP 200 | ||
[Asserts] | ||
header "Content-Type" == "application/json" | ||
#jsonpath "$[1].mime_type" == "video/mp4" | ||
|
||
|
||
|
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,38 @@ | ||
############################################################## | ||
## Start a realtime | ||
############################################################## | ||
PUT {{ base_api }}/transcripts/realtime | ||
Accept: application/json | ||
Content-Type: application/json | ||
api-key: {{ apikey }} | ||
{ | ||
"language": "en", | ||
"streamUrl": "https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index_1M.m3u8", | ||
"transcriptDelay":"5", | ||
"title": "hurl test" | ||
} | ||
|
||
HTTP 200 | ||
[Captures] | ||
trintid: jsonpath "$._id" | ||
[Asserts] | ||
header "Content-Type" == "application/json" | ||
|
||
############################################################## | ||
## Status realtime | ||
############################################################## | ||
|
||
# Status for a realtime | ||
GET {{ base_api }}/transcripts/realtime/{{ trintid }} | ||
Accept: application/json | ||
Content-Type: application/json | ||
api-key: {{ apikey }} | ||
|
||
HTTP 200 | ||
[Asserts] | ||
header "Content-Type" == "application/json" | ||
jsonpath "$.status" exists | ||
jsonpath "$.started" exists | ||
jsonpath "$.expires" exists | ||
jsonpath "$.status" == "TRANSCRIBING" | ||
|