forked from Inist-CNRS/web-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.hurl
105 lines (89 loc) · 3.26 KB
/
tests.hurl
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# WARNING: This file was not generated, but manually written.
# DON'T OVERWRITE IT
# Use it to test:
# npx hurl --test --variable host="http://localhost:31976" tests.hurl
# or (from root of the repo)
# npm run test:local data-termsuite
# WARNING: The webhook URLs don't last forever.
# Without activity, they expire after one week!
# That can be the cause of failing tests, using docker.
# Thus, there are commented here.
############################################################################
# Test v1/base-line
POST {{host}}/v1/base-line
content-type: application/x-gzip
# X-Webhook-Success: https://webhook.site/684dd427-5484-404a-b5a0-80e5b6726a1c
# X-Webhook-Failure: https://webhook.site/684dd427-5484-404a-b5a0-80e5b6726a1c
file,./22-txt-en.tar.gz;
HTTP 200
Content-Type: application/json
# Capture the computing token
[Captures]
computing_token: jsonpath "$[0].value"
[Asserts]
variable "computing_token" exists
# There should be a waiting time, representing the time taken to process data.
# Fortunately, as the data is sparse, and the computing time is small,
# the need is small.
# In normal use cases, a webhook is called when the processing is finished.
# That query gives the process identifier.
# Next, you can call the retrieve URL by putting the identifier in the value field.
# Version 4.1.0 of hurl added a delay option, which value is milliseconds.
# https://hurl.dev/blog/2023/09/24/announcing-hurl-4.1.0.html#add-delay-between-requests
POST {{host}}/v1/retrieve-json
content-type: application/json
Connection: Keep-Alive
Keep-Alive: 300
Accept-Encoding: gzip, deflate
[Options]
delay: 1000
```
[
{
"value":"{{computing_token}}"
}
]
```
HTTP 200
Content-Type: application/json
[Asserts]
jsonpath "$" count == 22
jsonpath "$[0].value" startsWith " Paleogene evolution and demise"
# From here, the tests can't succeed on GitHub Actions, please test using
# real-tests.hurl
# ############################################################################
# # Test v1/tag-cloud-en
# POST {{host}}/v1/tag-cloud-en
# content-type: application/x-gzip
# # X-Webhook-Success: https://webhook.site/684dd427-5484-404a-b5a0-80e5b6726a1c
# # X-Webhook-Failure: https://webhook.site/684dd427-5484-404a-b5a0-80e5b6726a1c
# file,./22-txt-en.tar.gz;
# HTTP 200
# Content-Type: application/json
# # Capture the computing token
# [Captures]
# computing_token: jsonpath "$[0].value"
# [Asserts]
# variable "computing_token" exists
# # There should be a waiting time, representing the time taken to process data.
# # Fortunately, as the data is sparse, and the computing time is small,
# # the need is small.
# # In normal use cases, a webhook is called when the processing is finished.
# # That query gives the process identifier.
# # Next, you can call the retrieve URL by putting the identifier in the value field.
# # Version 4.1.0 of hurl added a delay option, which value is milliseconds.
# # https://hurl.dev/blog/2023/09/24/announcing-hurl-4.1.0.html#add-delay-between-requests
# POST {{host}}/v1/retrieve-json
# content-type: application/json
# [Options]
# delay: 2000
# ```
# [
# {
# "value":"{{computing_token}}"
# }
# ]
# ```
# HTTP 200
# Content-Type: application/json
# [{"id":"aridification","value":2},{"id":"mafic","value":2},{"id":"climate change","value":3}]