Update very_verbose integration test.

This commit is contained in:
jcamiel 2022-07-05 17:24:18 +02:00 committed by Fabrice Reix
parent e15b431fed
commit 6d6a0d6842
7 changed files with 96 additions and 11 deletions

View File

@ -1,5 +1,6 @@
curl 'http://localhost:8000/very-verbose/redirect' -L
curl 'http://localhost:8000/very-verbose/encoding/latin1' -L
curl 'http://localhost:8000/very-verbose/compressed/brotli' -X POST -H 'Accept-Encoding: brotli' -L
curl 'http://localhost:8000/very-verbose/compressed/brotli' -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L
curl 'http://localhost:8000/very-verbose/cat' -L
curl 'http://localhost:8000/very-verbose/update-cat' -F 'cat=@integration/tests_ok/cat.jpg;type=image/jpeg' -L
curl 'http://localhost:8000/very-verbose/done' -H 'x-foo: bar' -L

View File

@ -19,6 +19,8 @@
> Accept: */*
> User-Agent: hurl/~~~-snapshot
>
* Request body:
*
< HTTP/1.0 301 MOVED PERMANENTLY
< Content-Type: text/html; charset=utf-8
< Content-Length: 205
@ -26,7 +28,7 @@
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* <html>
* <head>
* <meta content="text/html;charset=utf-8">
@ -43,13 +45,15 @@
> Accept: */*
> User-Agent: hurl/~~~-snapshot
>
* Request body:
*
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 11
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* Redirected.
*
* ------------------------------------------------------------------------------
@ -68,13 +72,15 @@
> Accept: */*
> User-Agent: hurl/~~~-snapshot
>
* Request body:
*
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=ISO-8859-1
< Content-Length: 4
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* café
*
* ------------------------------------------------------------------------------
@ -86,15 +92,24 @@
* POST http://localhost:8000/very-verbose/compressed/brotli
* Accept-Encoding: brotli
*
* Implicit content-type=application/json
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/very-verbose/compressed/brotli' -X POST -H 'Accept-Encoding: brotli' -L
* curl 'http://localhost:8000/very-verbose/compressed/brotli' -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L
*
> POST /very-verbose/compressed/brotli HTTP/1.1
> Host: localhost:8000
> Accept: */*
> Accept-Encoding: brotli
> User-Agent: hurl/1.7.0-snapshot
> Content-Type: application/json
> User-Agent: hurl/~~~-snapshot
> Content-Length: 37
>
* Request body:
* {
* "foo": "bar",
* "baz": true
* }
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 17
@ -102,7 +117,7 @@
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* Hello World!
*
* ------------------------------------------------------------------------------
@ -121,13 +136,15 @@
> Accept: */*
> User-Agent: hurl/~~~-snapshot
>
* Request body:
*
< HTTP/1.0 200 OK
< Content-Type: image/jpeg
< Content-Length: 25992
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* Bytes <f198388ba26c2c53005f24643826384f15ba905b8ca070a470b61885c6639f8bbfe63fcee5fb498a630249e499e4eddcc9ca793406c14d02c97107e09c7af57a...>
*
* ------------------------------------------------------------------------------
@ -136,6 +153,39 @@
* Cookie store:
*
* Request:
* POST http://localhost:8000/very-verbose/update-cat
* [MultipartFormData]
* cat: file,cat.jpg; image/jpeg
*
* Implicit content-type=multipart/form-data
*
* Request can be run with the following curl command:
* curl 'http://localhost:8000/very-verbose/update-cat' -F 'cat=@tests_ok~cat.jpg;type=image/jpeg' -L
*
> POST /very-verbose/update-cat HTTP/1.1
> Host: localhost:8000
> Accept: */*
> User-Agent: hurl/~~~-snapshot
> Content-Length: 26572
> Content-Type: multipart/form-data; boundary=~~~~~
>
* Request body:
* Bytes <~~~~~...>
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response body:
*
*
* ------------------------------------------------------------------------------
* Executing entry 6
*
* Cookie store:
*
* Request:
* GET http://localhost:8000/very-verbose/done
* x-foo: bar
*
@ -148,12 +198,14 @@
> x-foo: bar
> User-Agent: hurl/~~~-snapshot
>
* Request body:
*
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 4
< Server: Flask Server
< Date: ~~~, ~~ ~~~ ~~~~ ~~:~~:~~ GMT
<
* Response:
* Response body:
* Done
*

View File

@ -6,11 +6,20 @@
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">POST</span> <span class="url">http://localhost:8000/very-verbose/compressed/brotli</span></span>
<span class="line"><span class="string">Accept-Encoding</span><span>:</span> <span class="string">brotli</span></span>
<span class="json"><span class="line">{</span>
<span class="line"> "foo": "bar",</span>
<span class="line"> "baz": true</span>
<span class="line">}</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/very-verbose/cat</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">POST</span> <span class="url">http://localhost:8000/very-verbose/update-cat</span></span>
<span class="line section-header">[MultipartFormData]</span>
<span class="line"><span class="string"><span class="string">cat</span></span>: file,<span class="string"><span class="filename">cat.jpg</span></span>; <span class="string">image/jpeg</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/very-verbose/done</span></span>
<span class="line"><span class="string">x-foo</span><span>:</span> <span class="string">bar</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span>

View File

@ -6,11 +6,20 @@ HTTP/* 200
POST http://localhost:8000/very-verbose/compressed/brotli
Accept-Encoding: brotli
{
"foo": "bar",
"baz": true
}
HTTP/* 200
GET http://localhost:8000/very-verbose/cat
HTTP/* 200
POST http://localhost:8000/very-verbose/update-cat
[MultipartFormData]
cat: file,cat.jpg; image/jpeg
HTTP/* 200
GET http://localhost:8000/very-verbose/done
x-foo: bar
HTTP/* 200

View File

@ -1 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/redirect"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/encoding/latin1"},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/very-verbose/compressed/brotli","headers":[{"name":"Accept-Encoding","value":"brotli"}]},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/cat"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/done","headers":[{"name":"x-foo","value":"bar"}]},"response":{"status":200}}]}
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/redirect"},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/encoding/latin1"},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/very-verbose/compressed/brotli","headers":[{"name":"Accept-Encoding","value":"brotli"}],"body":{"type":"json","value":{"foo":"bar","baz":true}}},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/cat"},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/very-verbose/update-cat","multipart_form_data":[{"name":"cat","filename":"cat.jpg","content_type":"image/jpeg"}]},"response":{"status":200}},{"request":{"method":"GET","url":"http://localhost:8000/very-verbose/done","headers":[{"name":"x-foo","value":"bar"}]},"response":{"status":200}}]}

View File

@ -55,7 +55,7 @@ def very_verbose_compressed_brotli():
@app.route("/very-verbose/cat")
def very_verbose_image():
def very_verbose_cat():
with open("tests_ok/cat.jpg.br", "rb") as f:
data = f.read()
resp = make_response(data)
@ -63,6 +63,14 @@ def very_verbose_image():
return resp
@app.route("/very-verbose/update-cat", methods=["POST"])
def very_verbose_update_cat():
upload = request.files["cat"]
assert upload.filename == "cat.jpg"
assert upload.content_type == "image/jpeg"
return ""
@app.route("/very-verbose/done")
def very_verbose_done():
return "Done"

View File

@ -0,0 +1,6 @@
curl 'http://localhost:8000/very-verbose/redirect' -L
curl 'http://localhost:8000/very-verbose/encoding/latin1' -L
curl 'http://localhost:8000/very-verbose/compressed/brotli' -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L
curl 'http://localhost:8000/very-verbose/cat' -L
curl 'http://localhost:8000/very-verbose/update-cat' -F 'cat=@tests_ok\cat.jpg;type=image/jpeg' -L
curl 'http://localhost:8000/very-verbose/done' -H 'x-foo: bar' -L