diff --git a/tests/bulk_operation.rs b/tests/bulk_operation.rs index 61cdd45..fe796f7 100644 --- a/tests/bulk_operation.rs +++ b/tests/bulk_operation.rs @@ -5,7 +5,7 @@ use mongo_driver::client::ClientPool; #[test] fn test_execute_error() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let collection = client.get_collection("rust_driver_test", "bulk_operation_error"); @@ -20,7 +20,7 @@ fn test_execute_error() { #[test] fn test_insert_remove_replace_update() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let mut collection = client.get_collection("rust_driver_test", "bulk_operation_insert"); diff --git a/tests/cursor.rs b/tests/cursor.rs index e818289..5ed0236 100644 --- a/tests/cursor.rs +++ b/tests/cursor.rs @@ -8,7 +8,7 @@ use mongo_driver::Result; #[test] fn test_cursor() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let mut collection = client.get_collection("rust_driver_test", "cursor_items"); @@ -23,8 +23,6 @@ fn test_cursor() { let query = doc! {}; let cursor = collection.find(&query, None).unwrap(); - assert!(cursor.is_alive()); - let documents = cursor.into_iter().collect::>>(); // See if we got 10 results and the iterator then stopped @@ -35,7 +33,7 @@ fn test_cursor() { fn test_tailing_cursor() { // See: http://api.mongodb.org/c/1.1.8/cursors.html#tailable - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let database = client.get_database("rust_test"); diff --git a/tests/database.rs b/tests/database.rs index 3f81419..6e744dd 100644 --- a/tests/database.rs +++ b/tests/database.rs @@ -3,7 +3,7 @@ use mongo_driver::client::ClientPool; #[test] fn test_command() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let database = client.get_database("rust_test"); @@ -16,7 +16,7 @@ fn test_command() { #[test] fn test_get_collection_and_name() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let database = client.get_database("rust_test"); @@ -29,7 +29,7 @@ fn test_get_collection_and_name() { #[test] fn test_create_collection() { - let uri = Uri::new("mongodb://localhost:27017/"); + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let database = client.get_database("rust_test"); diff --git a/tests/flags.rs b/tests/flags.rs index e51af4b..5813938 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -1,37 +1,37 @@ -use mongo_driver::FlagsValue; +use mongo_driver::flags::{Flags,FlagsValue,InsertFlag,RemoveFlag,QueryFlag}; #[test] pub fn test_insert_flags() { - let mut flags = super::Flags::new(); + let mut flags = Flags::new(); assert_eq!(0, flags.flags()); - flags.add(super::InsertFlag::ContinueOnError); + flags.add(InsertFlag::ContinueOnError); assert_eq!(1, flags.flags()); - flags.add(super::InsertFlag::NoValidate); - flags.add(super::InsertFlag::NoValidate); + flags.add(InsertFlag::NoValidate); + flags.add(InsertFlag::NoValidate); assert_eq!(31, flags.flags()); } #[test] pub fn test_query_flags() { - let mut flags = super::Flags::new(); + let mut flags = Flags::new(); assert_eq!(0, flags.flags()); - flags.add(super::QueryFlag::TailableCursor); + flags.add(QueryFlag::TailableCursor); assert_eq!(2, flags.flags()); - flags.add(super::QueryFlag::Partial); - flags.add(super::QueryFlag::Partial); + flags.add(QueryFlag::Partial); + flags.add(QueryFlag::Partial); assert_eq!(130, flags.flags()); } #[test] pub fn test_remove_flags() { - let mut flags = super::Flags::new(); + let mut flags = Flags::new(); assert_eq!(0, flags.flags()); - flags.add(super::RemoveFlag::SingleRemove); - flags.add(super::RemoveFlag::SingleRemove); + flags.add(RemoveFlag::SingleRemove); + flags.add(RemoveFlag::SingleRemove); assert_eq!(1, flags.flags()); } diff --git a/tests/read_prefs.rs b/tests/read_prefs.rs index 1f6a769..363eb05 100644 --- a/tests/read_prefs.rs +++ b/tests/read_prefs.rs @@ -1,4 +1,4 @@ -use mongo_driver::ReadPrefs; +use mongo_driver::read_prefs::ReadPrefs; #[test] fn test_read_prefs() { diff --git a/tests/tests.rs b/tests/tests.rs index a6c938f..80fa378 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -3,5 +3,12 @@ extern crate mongo_driver; #[macro_use] extern crate bson; +mod bulk_operation; mod client; mod collection; +mod cursor; +mod database; +mod flags; +mod read_prefs; +mod uri; +mod write_concern; diff --git a/tests/uri.rs b/tests/uri.rs index 1189f2b..63de950 100644 --- a/tests/uri.rs +++ b/tests/uri.rs @@ -1,15 +1,12 @@ -use mongo_driver::Uri; +use mongo_driver::uri::Uri; -#[cfg(test)] -mod tests { - #[test] - fn test_new_uri() { - let uri = Uri::new("mongodb://localhost:27017/"); - assert_eq!("mongodb://localhost:27017/", uri.as_str()); - } +#[test] +fn test_new_uri() { + let uri = Uri::new("mongodb://localhost:27017/").unwrap(); + assert_eq!("mongodb://localhost:27017/", uri.as_str()); +} - #[test] - fn test_new_invalid_uri() { - assert!(Uri::new("@:/mongo::").is_none()); - } +#[test] +fn test_new_invalid_uri() { + assert!(Uri::new("@:/mongo::").is_none()); } diff --git a/tests/write_concern.rs b/tests/write_concern.rs index e53ef50..f55cd3c 100644 --- a/tests/write_concern.rs +++ b/tests/write_concern.rs @@ -1,10 +1,7 @@ -use mongo_driver::WriteConcern; +use mongo_driver::write_concern::WriteConcern; -#[cfg(test)] -mod tests { - #[test] - fn test_write_concern() { - let write_concern = WriteConcern::new(); - assert!(!write_concern.inner().is_null()); - } +#[test] +fn test_write_concern() { + let write_concern = WriteConcern::new(); + assert!(!write_concern.inner().is_null()); }