diff options
author | khai96_ <hvksmr1996@gmail.com> | 2019-04-29 11:37:04 +0000 |
---|---|---|
committer | khai96_ <hvksmr1996@gmail.com> | 2019-04-29 11:37:04 +0000 |
commit | 014bc52dc0e693bca8183bcf19c813452a34cc1c (patch) | |
tree | f161e26514cf65e37ce869aea205e59e52dcbcc8 /tests/helpers.rs | |
parent | Split integration test into multiple files (diff) | |
download | miniserve-014bc52dc0e693bca8183bcf19c813452a34cc1c.tar.gz miniserve-014bc52dc0e693bca8183bcf19c813452a34cc1c.zip |
Move helpers.rs to fixtures/mod.rs
Diffstat (limited to 'tests/helpers.rs')
-rw-r--r-- | tests/helpers.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/helpers.rs b/tests/helpers.rs deleted file mode 100644 index 3c5ad72..0000000 --- a/tests/helpers.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub use assert_cmd::prelude::*; -pub use assert_fs::fixture::TempDir; -pub use assert_fs::prelude::*; -pub use clap::{crate_name, crate_version}; -pub use port_check::free_local_port; -pub use reqwest; -pub use reqwest::multipart; -pub use rstest::rstest; -pub use select::document::Document; -pub use select::predicate::{Attr, Text}; -pub use std::process::{Command, Stdio}; -pub use std::thread::sleep; -pub use std::time::Duration; -pub use rstest::rstest_parametrize; - -/// Error type used by tests -pub type Error = Box<std::error::Error>; - -/// File names for testing purpose -pub static FILES: &[&str] = &["test.txt", "test.html", "test.mkv"]; - -/// Test fixture which creates a temporary directory with a few files inside. -pub fn tmpdir() -> TempDir { - let tmpdir = assert_fs::TempDir::new().expect("Couldn't create a temp dir for tests"); - for &file in FILES { - tmpdir - .child(file) - .write_str("Test Hello Yes") - .expect("Couldn't write to file"); - } - tmpdir -} - -/// Get a free port. -pub fn port() -> u16 { - free_local_port().expect("Couldn't find a free local port") -} |