Update integration tests.

This commit is contained in:
jcamiel 2022-10-15 22:39:47 +02:00
parent a58d4f27e0
commit 104360a05d
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
17 changed files with 353 additions and 11 deletions

View File

@ -1 +1 @@
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Invalid decoding\n --> tests_failed/assert_match_utf8.hurl:4:1\n |\n 4 | body matches \".*\"\n | ^^^^ the body can not be decoded with charset 'utf-8'\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert/match-utf8"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"1"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"time":~~~}],"filename":"tests~_failed/assert_match_utf8.hurl","success":false,"time":~~~}
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Invalid decoding\n --> tests_failed/assert_match_utf8.hurl:4:1\n |\n 4 | body matches \".*\"\n | ^^^^ the body can not be decoded with charset 'utf-8'\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert/match-utf8"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"1"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_match_utf8.hurl","success":false,"time":~~~}

View File

@ -1 +1 @@
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"message":"Assert status code\n --> tests_failed/assert_status.hurl:2:10\n |\n 2 | HTTP/1.0 200\n | ^^^ actual value is <404>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/not_found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"232"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":404}}],"captures":[],"time":~~~}],"filename":"tests_failed/assert_status.hurl","success":false,"time":~~~}
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"message":"Assert status code\n --> tests_failed/assert_status.hurl:2:10\n |\n 2 | HTTP/1.0 200\n | ^^^ actual value is <404>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/not_found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"232"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":404}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_status.hurl","success":false,"time":~~~}

View File

@ -1 +1 @@
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Undefined variable\n --> tests_failed/assert_template_variable_not_found.hurl:4:33\n |\n 4 | header \"content-type\" equals \"{{content_type}}\"\n | ^^^^^^^^^^^^ you must set the variable content_type\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert-template-variable-not-found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"0"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"time":~~~}],"filename":"tests_failed/assert_template_variable_not_found.hurl","success":false,"time":~~~}
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Undefined variable\n --> tests_failed/assert_template_variable_not_found.hurl:4:33\n |\n 4 | header \"content-type\" equals \"{{content_type}}\"\n | ^^^^^^^^^^^^ you must set the variable content_type\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert-template-variable-not-found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"0"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_template_variable_not_found.hurl","success":false,"time":~~~}

View File

@ -1 +1 @@
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:4:0\n |\n 4 | header \"content-type\" equals \"XXX\"\n | actual: string <text/html; charset=utf-8>\n | expected: string <XXX>\n |","success":false},{"line":5,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:5:0\n |\n 5 | header \"content-type\" notEquals \"text/html; charset=utf-8\"\n | actual: string <text/html; charset=utf-8>\n | expected: string <text/html; charset=utf-8>\n |","success":false},{"line":6,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:6:0\n |\n 6 | jsonpath \"$.id\" equals \"000001\"\n | actual: none\n | expected: string <000001>\n |","success":false},{"line":7,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:7:0\n |\n 7 | jsonpath \"$.values\" includes 100\n | actual: [int <1>, int <2>, int <3>]\n | expected: includes int <100>\n |","success":fals~e},{"line":8,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:8:0\n |\n 8 | jsonpath \"$.values\" not contains \"Hello\"\n | actual: [int <1>, int <2>, int <3>]\n | expected: not contains string <Hello>\n | >>> types between actual and expected are not consistent\n |","success":false},{"line":9,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:9:0\n |\n 9 | jsonpath \"$.count\" greaterThan 5\n | actual: int <2>\n | expected: greater than int <5>\n |","success":false},{"line":10,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:10:0\n |\n10 | jsonpath \"$.count\" isFloat\n | actual: int <2>\n | expected: float\n |","success":false},{"line":11,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:11:0\n |\n11 | bytes contains hex,00;\n | actual: byte array <7b202276616c756573223a205b312c322c335d2c2022636f756e74223a20327d>\n | expected: contains byte array <00>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert-value"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"32"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"time":~~~}],"filename":"tests_failed/assert_value_error.hurl","success":false,"time":~~~}
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":4,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:4:0\n |\n 4 | header \"content-type\" equals \"XXX\"\n | actual: string <text/html; charset=utf-8>\n | expected: string <XXX>\n |","success":false},{"line":5,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:5:0\n |\n 5 | header \"content-type\" notEquals \"text/html; charset=utf-8\"\n | actual: string <text/html; charset=utf-8>\n | expected: string <text/html; charset=utf-8>\n |","success":false},{"line":6,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:6:0\n |\n 6 | jsonpath \"$.id\" equals \"000001\"\n | actual: none\n | expected: string <000001>\n |","success":false},{"line":7,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:7:0\n |\n 7 | jsonpath \"$.values\" includes 100\n | actual: [int <1>, int <2>, int <3>]\n | expected: includes int <100>\n |","success":false},{"line":8,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:8:0\n |\n 8 | jsonpath \"$.values\" not contains \"Hello\"\n | actual: [int <1>, int <2>, int <3>]\n | expected: not contains string <Hello>\n | >>> types between actual and expected are not consistent\n |","success":false},{"line":9,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:9:0\n |\n 9 | jsonpath \"$.count\" greaterThan 5\n | actual: int <2>\n | expected: greater than int <5>\n |","success":false},{"line":10,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:10:0\n |\n10 | jsonpath \"$.count\" isFloat\n | actual: int <2>\n | expected: float\n |","success":false},{"line":11,"message":"Assert failure\n --> tests_failed/assert_value_error.hurl:11:0\n |\n11 | bytes contains hex,00;\n | actual: byte array <7b202276616c756573223a205b312c322c335d2c2022636f756e74223a20327d>\n | expected: contains byte array <00>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-assert-value"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"32"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_value_error.hurl","success":false,"time":~~~}

View File

@ -1 +1 @@
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":3,"message":"Header not found\n --> tests_failed/query_header_not_found.hurl:3:1\n |\n 3 | Custom: XXX\n | ^^^^^^ this header has not been found in the response\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-query-header-not-found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"12"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"time":~~~}],"filename":"tests_failed/query_header_not_found.hurl","success":false,"time":~~~}
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":3,"message":"Header not found\n --> tests_failed/query_header_not_found.hurl:3:1\n |\n 3 | Custom: XXX\n | ^^^^^^ this header has not been found in the response\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/error-query-header-not-found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"12"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/query_header_not_found.hurl","success":false,"time":~~~}

View File

@ -1 +1 @@
{"cookies":[{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie1","path":"/","value":"value1"},{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie2","path":"/","value":"value2"},{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie3","path":"/","value":"value3"}],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":3,"success":true},{"line":4,"success":true},{"line":5,"success":true},{"line":7,"success":true},{"line":8,"success":true},{"line":9,"success":true},{"line":10,"success":true},{"line":11,"success":true},{"line":12,"success":true},{"line":13,"success":true},{"line":14,"success":true}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/assert-header"},"response":{"cookies":[{"name":"cookie1","path":"/","value":"value1"},{"name":"cookie2","path":"/","value":"value2"},{"name":"cookie3","path":"/","value":"value3"}],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Header1","value":"value1"},{"name":"ETag","value":"\"33a64df551425fcc55e4d42a148795d9f25f89d4\""},{"name":"Set-Cookie","value":"cookie1=value1; Path=/"},{"name":"Set-Cookie","value":"cookie2=value2; Path=/"},{"name":"Set-Cookie","value":"cookie3=value3; Path=/"},{"name":"Server","value":"Flask Server"},{"name":"Content-Length","value":"0"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"time":~~~}],"filename":"tests_ok/assert_header.hurl","success":true,"time":~~~}
{"cookies":[{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie1","path":"/","value":"value1"},{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie2","path":"/","value":"value2"},{"domain":"localhost","expires":"0","https":"FALSE","include_subdomain":"FALSE","name":"cookie3","path":"/","value":"value3"}],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"success":true},{"line":3,"success":true},{"line":4,"success":true},{"line":5,"success":true},{"line":7,"success":true},{"line":8,"success":true},{"line":9,"success":true},{"line":10,"success":true},{"line":11,"success":true},{"line":12,"success":true},{"line":13,"success":true},{"line":14,"success":true}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/assert-header"},"response":{"cookies":[{"name":"cookie1","path":"/","value":"value1"},{"name":"cookie2","path":"/","value":"value2"},{"name":"cookie3","path":"/","value":"value3"}],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Header1","value":"value1"},{"name":"ETag","value":"\"33a64df551425fcc55e4d42a148795d9f25f89d4\""},{"name":"Set-Cookie","value":"cookie1=value1; Path=/"},{"name":"Set-Cookie","value":"cookie2=value2; Path=/"},{"name":"Set-Cookie","value":"cookie3=value3; Path=/"},{"name":"Server","value":"Flask Server"},{"name":"Content-Length","value":"0"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":200}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_ok/assert_header.hurl","success":true,"time":~~~}

View File

@ -1,6 +1,7 @@
* Options:
* fail fast: true
* insecure: false
* follow redirect: false
* insecure: false
* max redirect: 50
warning: No entry have been executed for file tests_ok/color.hurl
* retry: false
warning: No entry have been executed for file tests_ok/color.hurl

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,244 @@
* Options:
* fail fast: true
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: true
* ------------------------------------------------------------------------------
* Executing entry 1
*
* Cookie store:
*
* Request:
* POST http://localhost:8000/jobs
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs' -X POST
*
> POST /jobs HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 60 bytes in ~~~ ms)
*
< HTTP/1.0 201 CREATED
< Content-Type: application/json
< Content-Length: 60
< Server: Flask Server
< Date: ~~~
<
* Captures:
* job_id: ~~~
*
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 60 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 60
< Server: Flask Server
< Date: ~~~
<
*
* Assert failure
* --> tests_ok/retry.hurl:16:0
* |
* 16 | jsonpath "$.state" == "COMPLETED"
* | actual: string <RUNNING>
* | expected: string <COMPLETED>
* |
*
* Retry entry 2 (x1 pause 100 ms)
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 60 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 60
< Server: Flask Server
< Date: ~~~
<
*
* Assert failure
* --> tests_ok/retry.hurl:16:0
* |
* 16 | jsonpath "$.state" == "COMPLETED"
* | actual: string <RUNNING>
* | expected: string <COMPLETED>
* |
*
* Retry entry 2 (x2 pause 100 ms)
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 60 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 60
< Server: Flask Server
< Date: ~~~
<
*
* Assert failure
* --> tests_ok/retry.hurl:16:0
* |
* 16 | jsonpath "$.state" == "COMPLETED"
* | actual: string <RUNNING>
* | expected: string <COMPLETED>
* |
*
* Retry entry 2 (x3 pause 100 ms)
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 60 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 60
< Server: Flask Server
< Date: ~~~
<
*
* Assert failure
* --> tests_ok/retry.hurl:16:0
* |
* 16 | jsonpath "$.state" == "COMPLETED"
* | actual: string <RUNNING>
* | expected: string <COMPLETED>
* |
*
* Retry entry 2 (x4 pause 100 ms)
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 62 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 62
< Server: Flask Server
< Date: ~~~
<
*
* ------------------------------------------------------------------------------
* Executing entry 3
*
* Cookie store:
*
* Request:
* DELETE http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~' -X DELETE
*
> DELETE /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 0 bytes in ~~~ ms)
*
< HTTP/1.0 200 OK
< Content-Type: application/json
< Server: Flask Server
< Content-Length: 0
< Date: ~~~
<
*
* ------------------------------------------------------------------------------
* Executing entry 4
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/jobs/~~~'
*
> GET /jobs/~~~ HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~
>
* Response: (received 42 bytes in ~~~ ms)
*
< HTTP/1.0 404 NOT FOUND
< Content-Type: application/json
< Content-Length: 42
< Server: Flask Server
< Date: ~~~
<
*

View File

@ -0,0 +1,25 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"></span><span class="comment"># Create a new job</span>
<span class="line"><span class="method">POST</span> <span class="url">http://localhost:8000/jobs</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/*</span> <span class="number">201</span></span>
<span class="line section-header">[Captures]</span>
<span class="line"><span class="name">job_id</span><span>:</span> <span class="query-type">jsonpath</span> <span class="string">"$.id"</span></span>
<span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.state"</span> <span class="predicate-type">==</span> <span class="string">"RUNNING"</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span>
<span class="line"></span><span class="comment"># Pull job status until it is completed</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/jobs/{{job_id}}</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span>
<span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.state"</span> <span class="predicate-type">==</span> <span class="string">"COMPLETED"</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span>
<span class="line"></span><span class="comment"># Delete the job</span>
<span class="line"><span class="method">DELETE</span> <span class="url">http://localhost:8000/jobs/{{job_id}}</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/jobs/{{job_id}}</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">404</span></span>
</span></span></code></pre>

View File

@ -0,0 +1,24 @@
# Create a new job
POST http://localhost:8000/jobs
HTTP/* 201
[Captures]
job_id: jsonpath "$.id"
[Asserts]
jsonpath "$.state" == "RUNNING"
# Pull job status until it is completed
GET http://localhost:8000/jobs/{{job_id}}
HTTP/* 200
[Asserts]
jsonpath "$.state" == "COMPLETED"
# Delete the job
DELETE http://localhost:8000/jobs/{{job_id}}
HTTP/* 200
GET http://localhost:8000/jobs/{{job_id}}
HTTP/* 404

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/jobs"},"response":{"status":201,"captures":[{"name":"job_id","query":{"type":"jsonpath","expr":"$.id"}}],"asserts":[{"query":{"type":"jsonpath","expr":"$.state"},"predicate":{"type":"equal","value":"RUNNING"}}]}},{"request":{"method":"GET","url":"http://localhost:8000/jobs/{{job_id}}"},"response":{"status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.state"},"predicate":{"type":"equal","value":"COMPLETED"}}]}},{"request":{"method":"DELETE","url":"http://localhost:8000/jobs/{{job_id}}"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/jobs/{{job_id}}"},"response":{"status":404}}]}

View File

@ -0,0 +1,5 @@
--retry
--retry-interval
100
--verbose
--json

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
import json
import uuid
from http import HTTPStatus
from app import app
from flask import Response
jobs = {}
@app.route("/jobs", methods=["POST"])
def new_job():
job_id = uuid.uuid4().hex
job = {"id": job_id, "state": "RUNNING", "count": 0}
jobs[job_id] = job
data = {"id": job_id, "state": "RUNNING"}
return data, HTTPStatus.CREATED
@app.route("/jobs/<job_id>")
def get_job(job_id):
job = jobs.get(job_id)
if not job:
data = {"error": "404", "message": "job not found"}
return data, HTTPStatus.NOT_FOUND
if job["state"] == "RUNNING":
job["count"] = job["count"] + 1
if job["count"] >= 5:
job["state"] = "COMPLETED"
data = {"id": job_id, "state": job["state"]}
return data
@app.route("/jobs/<job_id>", methods=["DELETE"])
def delete_job(job_id):
jobs.pop(job_id)
return Response(status=HTTPStatus.OK, mimetype="application/json")

View File

@ -1,8 +1,9 @@
* Options:
* fail fast: true
* insecure: false
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: false
* ------------------------------------------------------------------------------
* Executing entry 1
*

View File

@ -1,8 +1,9 @@
* Options:
* fail fast: true
* insecure: false
* follow redirect: true
* insecure: false
* max redirect: 50
* retry: false
* ------------------------------------------------------------------------------
* Executing entry 1
*