Re-add test modules

pull/9/head
Thijs Cadier 9 years ago
parent 6d5c6ec18d
commit ba41ae9549

@ -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");

@ -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::<Vec<Result<bson::Document>>>();
// 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");

@ -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");

@ -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());
}

@ -1,4 +1,4 @@
use mongo_driver::ReadPrefs;
use mongo_driver::read_prefs::ReadPrefs;
#[test]
fn test_read_prefs() {

@ -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;

@ -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());
}

@ -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());
}

Loading…
Cancel
Save