Skip to content

Commit 90f61e1

Browse files
sign
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
1 parent 240ab11 commit 90f61e1

6 files changed

Lines changed: 24 additions & 53 deletions

File tree

core/src/auth.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ impl HTTPAuthentication for Unauthenticated {
4747
{
4848
request.send().await
4949
}
50-
51-
async fn with_authentication<F>(
52-
&self,
53-
client: &ClientWithMiddleware,
54-
renew_request: &F,
55-
) -> Result<Response, reqwest_middleware::Error>
56-
where
57-
F: Fn(&ClientWithMiddleware) -> RequestBuilder + 'static,
58-
{
59-
self.request_with_authentication(renew_request(client), renew_request)
60-
.await
61-
}
6250
}
6351

6452
/// Authentication policy that *always* sends a username/password pair

core/src/config/local_fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ mod tests {
7777
url: "http://www.example.com".to_string(),
7878
..Default::default()
7979
}]),
80-
auth: None,
80+
// auth: None,
8181
};
8282
config_file
8383
.write_all(toml::to_string_pretty(&config).unwrap().as_bytes())

core/src/config/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct Config {
1212
pub quiet: Option<bool>,
1313
pub verbose: Option<bool>,
1414
pub index: Option<Vec<Index>>,
15-
pub auth: Option<Vec<AuthSource>>,
15+
// pub auth: Option<Vec<AuthSource>>,
1616
}
1717

1818
impl Config {
@@ -21,9 +21,9 @@ impl Config {
2121
self.verbose = self.verbose.or(config.verbose);
2222
extend_option_vec(&mut self.index, config.index);
2323

24-
if let Some(auth) = config.auth {
25-
self.auth = Some(auth.clone());
26-
}
24+
// if let Some(auth) = config.auth {
25+
// self.auth = Some(auth.clone());
26+
// }
2727
}
2828

2929
pub fn index_urls(
@@ -144,7 +144,7 @@ mod tests {
144144
url: "http://www.example.com".to_string(),
145145
..Default::default()
146146
}]),
147-
auth: None,
147+
// auth: None,
148148
};
149149
defaults.merge(config.clone());
150150

sysand/tests/cfg_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn cfg_set_quiet() -> Result<(), Box<dyn std::error::Error>> {
3232
quiet: Some(true),
3333
verbose: None,
3434
index: None,
35-
auth: None,
35+
// auth: None,
3636
})?;
3737

3838
let out_quiet_local_config =

sysand/tests/cli_info.rs

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -330,18 +330,9 @@ fn info_basic_http_url_auth() -> Result<(), Box<dyn Error>> {
330330
["info", "--iri", &server.url()],
331331
None,
332332
&IndexMap::from([
333-
(
334-
"SYSAND_CRED_TEST".to_string(),
335-
"http://127.0.0.1:*/**".to_string(),
336-
),
337-
(
338-
"SYSAND_CRED_TEST_BASIC_USER".to_string(),
339-
"user_1234".to_string(),
340-
),
341-
(
342-
"SYSAND_CRED_TEST_BASIC_PASS".to_string(),
343-
"pass_4321".to_string(),
344-
),
333+
("SYSAND_CRED_TEST", "http://127.0.0.1:*/**"),
334+
("SYSAND_CRED_TEST_BASIC_USER", "user_1234"),
335+
("SYSAND_CRED_TEST_BASIC_PASS", "pass_4321"),
345336
]),
346337
)?;
347338

@@ -870,19 +861,11 @@ fn info_multi_index_url_auth() -> Result<(), Box<dyn Error>> {
870861
.expect(2) // TODO: Reduce this to 1
871862
.create();
872863

864+
let server_pattern = format!("http://{}/**", server.host_with_port());
873865
let auth_env = IndexMap::from([
874-
(
875-
"SYSAND_CRED_TEST".to_string(),
876-
format!("http://{}/**", server.host_with_port()),
877-
),
878-
(
879-
"SYSAND_CRED_TEST_BASIC_USER".to_string(),
880-
"user_1234".to_string(),
881-
),
882-
(
883-
"SYSAND_CRED_TEST_BASIC_PASS".to_string(),
884-
"pass_4321".to_string(),
885-
),
866+
("SYSAND_CRED_TEST", server_pattern.as_ref()),
867+
("SYSAND_CRED_TEST_BASIC_USER", "user_1234"),
868+
("SYSAND_CRED_TEST_BASIC_PASS", "pass_4321"),
886869
]);
887870

888871
let (_, _, out) = run_sysand_with(

sysand/tests/common/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use camino_tempfile::Utf8TempDir;
66
use indexmap::IndexMap;
77
#[cfg(not(target_os = "windows"))]
88
use rexpect::session::{PtySession, spawn_command};
9-
#[cfg(not(target_os = "windows"))]
10-
use std::os::unix::process::ExitStatusExt;
119
use std::{
1210
error::Error,
1311
io::Write,
1412
process::{Command, Output},
1513
};
14+
#[cfg(not(target_os = "windows"))]
15+
use std::{ffi::OsStr, os::unix::process::ExitStatusExt};
1616

1717
pub fn fixture_path(name: &str) -> Utf8PathBuf {
1818
let mut path = Utf8PathBuf::from(env!("CARGO_MANIFEST_DIR"));
@@ -26,7 +26,7 @@ pub fn sysand_cmd_in_with<'a, I: IntoIterator<Item = &'a str>>(
2626
cwd: &Utf8Path,
2727
args: I,
2828
cfg: Option<&str>,
29-
env: &IndexMap<String, String>,
29+
env: &IndexMap<impl AsRef<OsStr>, impl AsRef<OsStr>>,
3030
) -> Result<Command, Box<dyn Error>> {
3131
let cfg_args = if let Some(config) = cfg {
3232
let config_path = cwd.join("sysand.toml");
@@ -60,7 +60,7 @@ pub fn sysand_cmd_in<'a, I: IntoIterator<Item = &'a str>>(
6060
args: I,
6161
cfg: Option<&str>,
6262
) -> Result<Command, Box<dyn Error>> {
63-
sysand_cmd_in_with(cwd, args, cfg, &IndexMap::default())
63+
sysand_cmd_in_with(cwd, args, cfg, &IndexMap::<&str, &str>::default())
6464
}
6565

6666
/// Creates a temporary directory and returns the tuple of the temporary
@@ -78,7 +78,7 @@ pub fn new_temp_cwd() -> Result<(Utf8TempDir, Utf8PathBuf), Box<dyn Error>> {
7878
pub fn sysand_cmd<'a, I: IntoIterator<Item = &'a str>>(
7979
args: I,
8080
cfg: Option<&str>,
81-
env: &IndexMap<String, String>,
81+
env: &IndexMap<impl AsRef<OsStr>, impl AsRef<OsStr>>,
8282
) -> Result<(Utf8TempDir, Utf8PathBuf, Command), Box<dyn Error>> {
8383
// NOTE had trouble getting test-temp-dir crate working, but would be better
8484
let (temp_dir, cwd) = new_temp_cwd()?;
@@ -91,7 +91,7 @@ pub fn run_sysand_in_with<'a, I: IntoIterator<Item = &'a str>>(
9191
cwd: &Utf8Path,
9292
args: I,
9393
cfg: Option<&str>,
94-
env: &IndexMap<String, String>,
94+
env: &IndexMap<impl AsRef<OsStr>, impl AsRef<OsStr>>,
9595
) -> Result<Output, Box<dyn Error>> {
9696
Ok(sysand_cmd_in_with(cwd, args, cfg, env)?.output()?)
9797
}
@@ -107,7 +107,7 @@ pub fn run_sysand_in<'a, I: IntoIterator<Item = &'a str>>(
107107
pub fn run_sysand_with<'a, I: IntoIterator<Item = &'a str>>(
108108
args: I,
109109
cfg: Option<&str>,
110-
env: &IndexMap<String, String>,
110+
env: &IndexMap<impl AsRef<OsStr>, impl AsRef<OsStr>>,
111111
) -> Result<(Utf8TempDir, Utf8PathBuf, Output), Box<dyn Error>> {
112112
let (temp_dir, cwd, mut cmd) = sysand_cmd(args /*, stdin*/, cfg, env)?;
113113

@@ -118,7 +118,7 @@ pub fn run_sysand<'a, I: IntoIterator<Item = &'a str>>(
118118
args: I,
119119
cfg: Option<&str>,
120120
) -> Result<(Utf8TempDir, Utf8PathBuf, Output), Box<dyn Error>> {
121-
run_sysand_with(args, cfg, &IndexMap::default())
121+
run_sysand_with(args, cfg, &IndexMap::<&str, &str>::default())
122122
}
123123

124124
// TODO: Figure out how to do interactive tests on Windows.
@@ -140,7 +140,7 @@ pub fn run_sysand_interactive_with<'a, I: IntoIterator<Item = &'a str>>(
140140
args: I,
141141
timeout_ms: Option<u64>,
142142
cfg: Option<&str>,
143-
env: &IndexMap<String, String>,
143+
env: &IndexMap<impl AsRef<OsStr>, impl AsRef<OsStr>>,
144144
) -> Result<(Utf8TempDir, Utf8PathBuf, PtySession), Box<dyn Error>> {
145145
let (temp_dir, cwd, cmd) = sysand_cmd(args, cfg, env)?;
146146

@@ -153,7 +153,7 @@ pub fn run_sysand_interactive<'a, I: IntoIterator<Item = &'a str>>(
153153
timeout_ms: Option<u64>,
154154
cfg: Option<&str>,
155155
) -> Result<(Utf8TempDir, Utf8PathBuf, PtySession), Box<dyn Error>> {
156-
run_sysand_interactive_with(args, timeout_ms, cfg, &IndexMap::default())
156+
run_sysand_interactive_with(args, timeout_ms, cfg, &IndexMap::<&str, &str>::default())
157157
}
158158

159159
// TODO: Figure out how to do interactive tests on Windows.

0 commit comments

Comments
 (0)