Fix pedantic clippy lints
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
25aea0f04d
commit
4b8730d6e0
@ -5,14 +5,14 @@ use tempfile::TempDir;
|
|||||||
#[test]
|
#[test]
|
||||||
fn no_repos() {
|
fn no_repos() {
|
||||||
let repos = TempDir::new().unwrap();
|
let repos = TempDir::new().unwrap();
|
||||||
assert_eq!(0, count_repositories(&repos).unwrap())
|
assert_eq!(0, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_repos_for_provider() {
|
fn no_repos_for_provider() {
|
||||||
let repos = TempDir::new().unwrap();
|
let repos = TempDir::new().unwrap();
|
||||||
let _provider = TempDir::new_in(&repos).unwrap();
|
let _provider = TempDir::new_in(&repos).unwrap();
|
||||||
assert_eq!(0, count_repositories(&repos).unwrap())
|
assert_eq!(0, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -20,7 +20,7 @@ fn no_repos_for_owner() {
|
|||||||
let repos = TempDir::new().unwrap();
|
let repos = TempDir::new().unwrap();
|
||||||
let provider = TempDir::new_in(&repos).unwrap();
|
let provider = TempDir::new_in(&repos).unwrap();
|
||||||
let _owner = TempDir::new_in(&provider).unwrap();
|
let _owner = TempDir::new_in(&provider).unwrap();
|
||||||
assert_eq!(0, count_repositories(&repos).unwrap())
|
assert_eq!(0, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -29,7 +29,7 @@ fn one_repo_for_owner() {
|
|||||||
let provider = TempDir::new_in(&repos).unwrap();
|
let provider = TempDir::new_in(&repos).unwrap();
|
||||||
let owner = TempDir::new_in(&provider).unwrap();
|
let owner = TempDir::new_in(&provider).unwrap();
|
||||||
let _repo = TempDir::new_in(&owner).unwrap();
|
let _repo = TempDir::new_in(&owner).unwrap();
|
||||||
assert_eq!(1, count_repositories(&repos).unwrap())
|
assert_eq!(1, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -39,7 +39,7 @@ fn two_repos_for_owner() {
|
|||||||
let owner = TempDir::new_in(&provider).unwrap();
|
let owner = TempDir::new_in(&provider).unwrap();
|
||||||
let _repo1 = TempDir::new_in(&owner).unwrap();
|
let _repo1 = TempDir::new_in(&owner).unwrap();
|
||||||
let _repo2 = TempDir::new_in(&owner).unwrap();
|
let _repo2 = TempDir::new_in(&owner).unwrap();
|
||||||
assert_eq!(2, count_repositories(&repos).unwrap())
|
assert_eq!(2, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -51,7 +51,7 @@ fn two_repos_for_two_providers() {
|
|||||||
let provider2 = TempDir::new_in(&repos).unwrap();
|
let provider2 = TempDir::new_in(&repos).unwrap();
|
||||||
let owner2 = TempDir::new_in(&provider2).unwrap();
|
let owner2 = TempDir::new_in(&provider2).unwrap();
|
||||||
let _repo2 = TempDir::new_in(&owner2).unwrap();
|
let _repo2 = TempDir::new_in(&owner2).unwrap();
|
||||||
assert_eq!(2, count_repositories(&repos).unwrap())
|
assert_eq!(2, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -62,5 +62,5 @@ fn two_subdirs_in_one_repo() {
|
|||||||
let repo = TempDir::new_in(&owner).unwrap();
|
let repo = TempDir::new_in(&owner).unwrap();
|
||||||
let _subdir1 = TempDir::new_in(&repo).unwrap();
|
let _subdir1 = TempDir::new_in(&repo).unwrap();
|
||||||
let _subdir2 = TempDir::new_in(&repo).unwrap();
|
let _subdir2 = TempDir::new_in(&repo).unwrap();
|
||||||
assert_eq!(1, count_repositories(&repos).unwrap())
|
assert_eq!(1, count_repositories(&repos).unwrap());
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,14 @@ pub async fn spawn_app() -> TestApp {
|
|||||||
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
||||||
|
|
||||||
let port = listener.local_addr().unwrap().port();
|
let port = listener.local_addr().unwrap().port();
|
||||||
let address = format!("http://127.0.0.1:{}", port);
|
let address = format!("http://127.0.0.1:{port}");
|
||||||
|
|
||||||
let _repo_dir = tempdir().expect("Cannot create repo_dir");
|
let repo_dir = tempdir().expect("Cannot create repo_dir");
|
||||||
let _cache_dir = tempdir().expect("Cannot create cache_dir");
|
let cache_dir = tempdir().expect("Cannot create cache_dir");
|
||||||
|
|
||||||
let mut settings = Settings::load().expect("Failed to read configuration.");
|
let mut settings = Settings::load().expect("Failed to read configuration.");
|
||||||
settings.repodir = _repo_dir.path().to_path_buf();
|
settings.repodir = repo_dir.path().to_path_buf();
|
||||||
settings.cachedir = _cache_dir.path().to_path_buf();
|
settings.cachedir = cache_dir.path().to_path_buf();
|
||||||
|
|
||||||
let server = hoc::run(listener, settings)
|
let server = hoc::run(listener, settings)
|
||||||
.await
|
.await
|
||||||
@ -44,7 +44,7 @@ pub async fn spawn_app() -> TestApp {
|
|||||||
|
|
||||||
TestApp {
|
TestApp {
|
||||||
address,
|
address,
|
||||||
_repo_dir,
|
_repo_dir: repo_dir,
|
||||||
_cache_dir,
|
_cache_dir: cache_dir,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user