mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-09-11 05:35:53 +03:00
Delete Rust integ Test for libcurl/HTTP module
These tests should be covered in the .hurl integ tests.
This commit is contained in:
parent
764eb52c8d
commit
62243800e6
7
integration/tests_failed/connect_timeout.err.pattern
Normal file
7
integration/tests_failed/connect_timeout.err.pattern
Normal file
@ -0,0 +1,7 @@
|
||||
error: HTTP connection
|
||||
--> tests_failed/connect_timeout.hurl:1:5
|
||||
|
|
||||
1 | GET http://10.0.0.0
|
||||
| ^^^^^^^^^^^^^^^ (~~) ~~~
|
||||
|
|
||||
|
7
integration/tests_failed/proxy_host.err
Normal file
7
integration/tests_failed/proxy_host.err
Normal file
@ -0,0 +1,7 @@
|
||||
error: HTTP connection
|
||||
--> tests_ok/hello.hurl:1:5
|
||||
|
|
||||
1 | GET http://localhost:8000/hello
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ (5) Could not resolve proxy: unknown
|
||||
|
|
||||
|
1
integration/tests_failed/proxy_host.exit
Normal file
1
integration/tests_failed/proxy_host.exit
Normal file
@ -0,0 +1 @@
|
||||
3
|
3
integration/tests_failed/proxy_host.ps1
Normal file
3
integration/tests_failed/proxy_host.ps1
Normal file
@ -0,0 +1,3 @@
|
||||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
hurl --proxy unknown tests_ok/hello.hurl
|
3
integration/tests_failed/proxy_host.sh
Executable file
3
integration/tests_failed/proxy_host.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
hurl --proxy unknown tests_ok/hello.hurl
|
7
integration/tests_failed/proxy_port.err.pattern
Normal file
7
integration/tests_failed/proxy_port.err.pattern
Normal file
@ -0,0 +1,7 @@
|
||||
error: HTTP connection
|
||||
--> tests_ok/hello.hurl:1:5
|
||||
|
|
||||
1 | GET http://localhost:8000/hello
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ (7) Failed to connect to localhost port 1111~~~
|
||||
|
|
||||
|
1
integration/tests_failed/proxy_port.exit
Normal file
1
integration/tests_failed/proxy_port.exit
Normal file
@ -0,0 +1 @@
|
||||
3
|
2
integration/tests_failed/proxy_port.hurl
Normal file
2
integration/tests_failed/proxy_port.hurl
Normal file
@ -0,0 +1,2 @@
|
||||
GET http://localhost:8000/hello
|
||||
HTTP 200
|
3
integration/tests_failed/proxy_port.ps1
Normal file
3
integration/tests_failed/proxy_port.ps1
Normal file
@ -0,0 +1,3 @@
|
||||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
hurl --proxy localhost:1111 tests_ok/hello.hurl
|
3
integration/tests_failed/proxy_port.sh
Executable file
3
integration/tests_failed/proxy_port.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
hurl --proxy localhost:1111 tests_ok/hello.hurl
|
7
integration/tests_failed/timeout.err.pattern
Normal file
7
integration/tests_failed/timeout.err.pattern
Normal file
@ -0,0 +1,7 @@
|
||||
error: HTTP connection
|
||||
--> tests_failed/timeout.hurl:1:5
|
||||
|
|
||||
1 | GET http://localhost:8000/timeout
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (28) Operation timed out after ~~~ milliseconds with 0 bytes received
|
||||
|
|
||||
|
@ -1,3 +1,3 @@
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://foo.com/hello'
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://bar.com/hello'
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://baz.com/hello'
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://foo.com/connect-to'
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://bar.com/connect-to'
|
||||
curl --connect-to foo.com:80:localhost:8000 --connect-to bar.com:80:localhost:8000 --connect-to baz.com:80:localhost:8000 'http://baz.com/connect-to'
|
@ -1,14 +1,14 @@
|
||||
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://foo.com/hello</span></span>
|
||||
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://foo.com/connect-to</span></span>
|
||||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
|
||||
<span class="line"><span class="string">`Hello World!`</span></span>
|
||||
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span class="method">GET</span> <span class="url">http://bar.com/hello</span></span>
|
||||
<span class="line"><span class="method">GET</span> <span class="url">http://bar.com/connect-to</span></span>
|
||||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
|
||||
<span class="line"><span class="string">`Hello World!`</span></span>
|
||||
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span class="method">GET</span> <span class="url">http://baz.com/hello</span></span>
|
||||
<span class="line"><span class="method">GET</span> <span class="url">http://baz.com/connect-to</span></span>
|
||||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
|
||||
<span class="line"><span class="string">`Hello World!`</span></span>
|
||||
</span></span></code></pre>
|
||||
|
@ -1,13 +1,13 @@
|
||||
GET http://foo.com/hello
|
||||
GET http://foo.com/connect-to
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
||||
|
||||
GET http://bar.com/hello
|
||||
GET http://bar.com/connect-to
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
||||
|
||||
GET http://baz.com/hello
|
||||
GET http://baz.com/connect-to
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
@ -1 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://foo.com/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://bar.com/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://baz.com/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}}]}
|
||||
{"entries":[{"request":{"method":"GET","url":"http://foo.com/connect-to"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://bar.com/connect-to"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://baz.com/connect-to"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}}]}
|
||||
|
6
integration/tests_ok/connect_to.py
Normal file
6
integration/tests_ok/connect_to.py
Normal file
@ -0,0 +1,6 @@
|
||||
from app import app
|
||||
|
||||
|
||||
@app.route("/connect-to")
|
||||
def connect_to():
|
||||
return "Hello World!"
|
@ -1,5 +1,9 @@
|
||||
<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/hello</span></span>
|
||||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
|
||||
<span class="line"><span class="string">Content-Type</span>: <span class="string">text/html; charset=utf-8</span></span>
|
||||
<span class="line"><span class="string">Content-Length</span>: <span class="string">12</span></span>
|
||||
<span class="line"><span class="section-header">[Asserts]</span></span>
|
||||
<span class="line"><span class="query-type">header</span> <span class="string">"Date"</span> <span class="predicate-type">exists</span></span>
|
||||
<span class="line"><span class="string">`Hello World!`</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/hello</span></span>
|
||||
|
@ -1,5 +1,9 @@
|
||||
GET http://localhost:8000/hello
|
||||
HTTP 200
|
||||
Content-Type: text/html; charset=utf-8
|
||||
Content-Length: 12
|
||||
[Asserts]
|
||||
header "Date" exists
|
||||
`Hello World!`
|
||||
|
||||
GET http://localhost:8000/hello
|
||||
|
@ -1 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"file","filename":"data.txt"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"encoding":"base64","value":"SGVsbG8gV29ybGQh"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"encoding":"base64","value":"SGVsbG8gV29ybGQh"}}}]}
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"12"}],"asserts":[{"query":{"type":"header","name":"Date"},"predicate":{"type":"exist"}}],"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"file","filename":"data.txt"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"encoding":"base64","value":"SGVsbG8gV29ybGQh"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"encoding":"base64","value":"SGVsbG8gV29ybGQh"}}}]}
|
||||
|
@ -4,7 +4,9 @@ from flask import request
|
||||
|
||||
@app.route("/hello")
|
||||
def hello():
|
||||
assert "Content-Type" not in request.headers
|
||||
assert "Content-Length" not in request.headers
|
||||
assert len(request.headers) == 3
|
||||
assert request.headers["Host"] == "localhost:8000"
|
||||
assert request.headers["Accept"] == "*/*"
|
||||
assert "User-Agent" in request.headers
|
||||
assert len(request.data) == 0
|
||||
return "Hello World!"
|
||||
|
@ -4,7 +4,6 @@ from flask import request
|
||||
|
||||
@app.route("/multipart-form-data", methods=["POST"])
|
||||
def multipart_form_data():
|
||||
|
||||
assert request.form["key1"] == "value1"
|
||||
assert "Expect" not in request.headers
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">PUT</span> <span class="url">http://localhost:8000/put</span></span>
|
||||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
|
||||
</span></span><span class="line"></span>
|
||||
</code></pre>
|
||||
<span class="line"><span class="section-header">[Asserts]</span></span>
|
||||
<span class="line"><span class="query-type">body</span> <span class="predicate-type">==</span> <span class="string">""</span></span>
|
||||
</span></span></code></pre>
|
||||
|
@ -1,3 +1,4 @@
|
||||
PUT http://localhost:8000/put
|
||||
HTTP 200
|
||||
|
||||
[Asserts]
|
||||
body == ""
|
||||
|
@ -1 +1 @@
|
||||
{"entries":[{"request":{"method":"PUT","url":"http://localhost:8000/put"},"response":{"status":200}}]}
|
||||
{"entries":[{"request":{"method":"PUT","url":"http://localhost:8000/put"},"response":{"status":200,"asserts":[{"query":{"type":"body"},"predicate":{"type":"equal","value":""}}]}}]}
|
||||
|
@ -1,3 +1,3 @@
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://foo.com:8000/hello'
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://bar.com:8000/hello'
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://baz.com:8000/hello'
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://foo.com:8000/resolve'
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://bar.com:8000/resolve'
|
||||
curl --resolve foo.com:8000:127.0.0.1 --resolve bar.com:8000:127.0.0.1 --resolve baz.com:8000:127.0.0.1 'http://baz.com:8000/resolve'
|
@ -1,13 +1,13 @@
|
||||
GET http://foo.com:8000/hello
|
||||
GET http://foo.com:8000/resolve
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
||||
|
||||
GET http://bar.com:8000/hello
|
||||
GET http://bar.com:8000/resolve
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
||||
|
||||
GET http://baz.com:8000/hello
|
||||
GET http://baz.com:8000/resolve
|
||||
HTTP 200
|
||||
`Hello World!`
|
||||
|
6
integration/tests_ok/resolve.py
Normal file
6
integration/tests_ok/resolve.py
Normal file
@ -0,0 +1,6 @@
|
||||
from app import app
|
||||
|
||||
|
||||
@app.route("/resolve")
|
||||
def resolve():
|
||||
return "Hello World!"
|
File diff suppressed because it is too large
Load Diff
@ -17,9 +17,6 @@
|
||||
*/
|
||||
use crate::http::{Header, Method, Param, RequestCookie, RequestSpec, Response};
|
||||
|
||||
mod libcurl;
|
||||
mod runner;
|
||||
|
||||
/// Some Request Response to be used by tests
|
||||
|
||||
pub fn hello_http_request() -> RequestSpec {
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Hurl (https://hurl.dev)
|
||||
* Copyright (C) 2023 Orange
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::runner;
|
||||
use crate::runner::RunnerOptions;
|
||||
use crate::util::logger::LoggerOptionsBuilder;
|
||||
|
||||
#[test]
|
||||
fn test_hello() {
|
||||
let content = "GET http://localhost;8000/hello";
|
||||
let logger_opts = LoggerOptionsBuilder::new().build();
|
||||
let variables = HashMap::new();
|
||||
let runner_opts = RunnerOptions::default();
|
||||
runner::run(content, &runner_opts, &variables, &logger_opts).unwrap();
|
||||
}
|
Loading…
Reference in New Issue
Block a user