mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Auto merge of #3424 - matklad:naming-things, r=alexcrichton
Minor, more explicit names Ultraminor renaming. Have to look at this tests because it fails if you link with older libgit.
This commit is contained in:
commit
d55dbc4415
@ -16,8 +16,8 @@ use hamcrest::assert_that;
|
|||||||
// Test that HTTP auth is offered from `credential.helper`
|
// Test that HTTP auth is offered from `credential.helper`
|
||||||
#[test]
|
#[test]
|
||||||
fn http_auth_offered() {
|
fn http_auth_offered() {
|
||||||
let a = TcpListener::bind("127.0.0.1:0").unwrap();
|
let server = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = a.local_addr().unwrap();
|
let addr = server.local_addr().unwrap();
|
||||||
|
|
||||||
fn headers(rdr: &mut BufRead) -> HashSet<String> {
|
fn headers(rdr: &mut BufRead) -> HashSet<String> {
|
||||||
let valid = ["GET", "Authorization", "Accept", "User-Agent"];
|
let valid = ["GET", "Authorization", "Accept", "User-Agent"];
|
||||||
@ -31,9 +31,9 @@ fn http_auth_offered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let t = thread::spawn(move|| {
|
let t = thread::spawn(move|| {
|
||||||
let mut s = BufStream::new(a.accept().unwrap().0);
|
let mut conn = BufStream::new(server.accept().unwrap().0);
|
||||||
let req = headers(&mut s);
|
let req = headers(&mut conn);
|
||||||
s.write_all(b"\
|
conn.write_all(b"\
|
||||||
HTTP/1.1 401 Unauthorized\r\n\
|
HTTP/1.1 401 Unauthorized\r\n\
|
||||||
WWW-Authenticate: Basic realm=\"wheee\"\r\n
|
WWW-Authenticate: Basic realm=\"wheee\"\r\n
|
||||||
\r\n\
|
\r\n\
|
||||||
@ -43,11 +43,11 @@ fn http_auth_offered() {
|
|||||||
"Accept: */*",
|
"Accept: */*",
|
||||||
"User-Agent: git/1.0 (libgit2 0.24.0)",
|
"User-Agent: git/1.0 (libgit2 0.24.0)",
|
||||||
].into_iter().map(|s| s.to_string()).collect());
|
].into_iter().map(|s| s.to_string()).collect());
|
||||||
drop(s);
|
drop(conn);
|
||||||
|
|
||||||
let mut s = BufStream::new(a.accept().unwrap().0);
|
let mut conn = BufStream::new(server.accept().unwrap().0);
|
||||||
let req = headers(&mut s);
|
let req = headers(&mut conn);
|
||||||
s.write_all(b"\
|
conn.write_all(b"\
|
||||||
HTTP/1.1 401 Unauthorized\r\n\
|
HTTP/1.1 401 Unauthorized\r\n\
|
||||||
WWW-Authenticate: Basic realm=\"wheee\"\r\n
|
WWW-Authenticate: Basic realm=\"wheee\"\r\n
|
||||||
\r\n\
|
\r\n\
|
||||||
@ -124,13 +124,13 @@ To learn more, run the command again with --verbose.
|
|||||||
// Boy, sure would be nice to have a TLS implementation in rust!
|
// Boy, sure would be nice to have a TLS implementation in rust!
|
||||||
#[test]
|
#[test]
|
||||||
fn https_something_happens() {
|
fn https_something_happens() {
|
||||||
let a = TcpListener::bind("127.0.0.1:0").unwrap();
|
let server = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = a.local_addr().unwrap();
|
let addr = server.local_addr().unwrap();
|
||||||
let t = thread::spawn(move|| {
|
let t = thread::spawn(move|| {
|
||||||
let mut s = a.accept().unwrap().0;
|
let mut conn = server.accept().unwrap().0;
|
||||||
drop(s.write(b"1234"));
|
drop(conn.write(b"1234"));
|
||||||
drop(s.shutdown(std::net::Shutdown::Write));
|
drop(conn.shutdown(std::net::Shutdown::Write));
|
||||||
drop(s.read(&mut [0; 16]));
|
drop(conn.read(&mut [0; 16]));
|
||||||
});
|
});
|
||||||
|
|
||||||
let p = project("foo")
|
let p = project("foo")
|
||||||
@ -152,10 +152,8 @@ fn https_something_happens() {
|
|||||||
assert_that(p.cargo_process("build").arg("-v"),
|
assert_that(p.cargo_process("build").arg("-v"),
|
||||||
execs().with_status(101).with_stderr_contains(&format!("\
|
execs().with_status(101).with_stderr_contains(&format!("\
|
||||||
[UPDATING] git repository `https://{addr}/foo/bar`
|
[UPDATING] git repository `https://{addr}/foo/bar`
|
||||||
",
|
", addr = addr))
|
||||||
addr = addr,
|
.with_stderr_contains(&format!("\
|
||||||
))
|
|
||||||
.with_stderr_contains(&format!("\
|
|
||||||
Caused by:
|
Caused by:
|
||||||
{errmsg}
|
{errmsg}
|
||||||
",
|
",
|
||||||
@ -176,10 +174,10 @@ Caused by:
|
|||||||
// Boy, sure would be nice to have an SSH implementation in rust!
|
// Boy, sure would be nice to have an SSH implementation in rust!
|
||||||
#[test]
|
#[test]
|
||||||
fn ssh_something_happens() {
|
fn ssh_something_happens() {
|
||||||
let a = TcpListener::bind("127.0.0.1:0").unwrap();
|
let server = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = a.local_addr().unwrap();
|
let addr = server.local_addr().unwrap();
|
||||||
let t = thread::spawn(move|| {
|
let t = thread::spawn(move|| {
|
||||||
drop(a.accept().unwrap());
|
drop(server.accept().unwrap());
|
||||||
});
|
});
|
||||||
|
|
||||||
let p = project("foo")
|
let p = project("foo")
|
||||||
@ -197,10 +195,8 @@ fn ssh_something_happens() {
|
|||||||
assert_that(p.cargo_process("build").arg("-v"),
|
assert_that(p.cargo_process("build").arg("-v"),
|
||||||
execs().with_status(101).with_stderr_contains(&format!("\
|
execs().with_status(101).with_stderr_contains(&format!("\
|
||||||
[UPDATING] git repository `ssh://{addr}/foo/bar`
|
[UPDATING] git repository `ssh://{addr}/foo/bar`
|
||||||
",
|
", addr = addr))
|
||||||
addr = addr,
|
.with_stderr_contains("\
|
||||||
))
|
|
||||||
.with_stderr_contains("\
|
|
||||||
Caused by:
|
Caused by:
|
||||||
[[..]] Failed to start SSH session: Failed getting banner
|
[[..]] Failed to start SSH session: Failed getting banner
|
||||||
"));
|
"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user