Harden bom integration test.

This commit is contained in:
jcamiel 2022-12-04 18:27:03 +01:00
parent 3dcaa675bb
commit 74cce8b994
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
6 changed files with 33 additions and 6 deletions

View File

@ -1,2 +1,2 @@
curl 'http://localhost:8000/utf8_bom' curl 'http://localhost:8000/utf8_bom'
curl 'http://localhost:8000/mirror' -H 'Content-Type:' --data '@tests_ok/bom.hurl'

View File

@ -1,6 +1,16 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/utf8_bom</span></span> <pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"></span><span class="comment"># This Hurl file begins with a BOM marker.</span>
<span class="line"></span><span class="comment"># You can check it with 'hexdump -c bom.hurl'</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/utf8_bom</span></span>
</span><span class="response"><span class="line"></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"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="multiline"><span class="line">```Hello World!```</span></span> <span class="multiline"><span class="line">```Hello World!```</span></span>
</span></span><span class="line"></span> </span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
</code></pre> <span class="line"></span><span class="comment"># We send the content of this file and get back the same</span>
<span class="line"></span><span class="comment"># bytes from /mirror to test the presence of the BOM marker.</span>
<span class="line"><span class="method">POST</span> <span class="url">http://localhost:8000/mirror</span></span>
<span class="line">file,<span class="filename">bom.hurl</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">bytes</span> <span class="predicate-type">startsWith</span> hex,<span class="hex">efbbbf</span>;</span>
</span></span></code></pre>

View File

@ -1,5 +1,15 @@
GET http://localhost:8000/utf8_bom # This Hurl file begins with a BOM marker.
# You can check it with 'hexdump -c bom.hurl'
GET http://localhost:8000/utf8_bom
HTTP 200 HTTP 200
```Hello World!``` ```Hello World!```
# We send the content of this file and get back the same
# bytes from /mirror to test the presence of the BOM marker.
POST http://localhost:8000/mirror
file,bom.hurl;
HTTP 200
[Asserts]
bytes startsWith hex,efbbbf;

View File

@ -1 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/utf8_bom"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}}]} {"entries":[{"request":{"method":"GET","url":"http://localhost:8000/utf8_bom"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"POST","url":"http://localhost:8000/mirror","body":{"type":"file","filename":"bom.hurl"}},"response":{"status":200,"asserts":[{"query":{"type":"bytes"},"predicate":{"type":"start-with","value":"77u/","encoding":"base64"}}]}}]}

View File

@ -5,3 +5,8 @@ from flask import request
@app.route("/utf8_bom") @app.route("/utf8_bom")
def utf8_bom(): def utf8_bom():
return "Hello World!" return "Hello World!"
@app.route("/mirror", methods=["POST"])
def mirror():
return request.data

View File

@ -0,0 +1,2 @@
curl 'http://localhost:8000/utf8_bom'
curl 'http://localhost:8000/mirror' -H 'Content-Type:' --data '@tests_ok\bom.hurl'