Skip to content

Commit c21a15d

Browse files
committed
Merge branch 'master' of https://github.com/http-rs/async-mongodb-session into update-deps
2 parents 3dd4514 + 4876e78 commit c21a15d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ target/
22
tmp/
33
Cargo.lock
44
.DS_Store
5+
.vscode/launch.json
6+
.cargo/config.toml

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@ impl SessionStore for MongodbSessionStore {
195195
self.initialize().await?;
196196
Ok(())
197197
}
198-
}
198+
}

tests/test.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ mod tests {
2222
lazy_static! {
2323
static ref HOST: String = env::var("HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
2424
static ref PORT: String = env::var("PORT").unwrap_or_else(|_| "27017".to_string());
25+
static ref DATABASE: String = env::var("DATABASE").unwrap_or_else(|_| "db_name".to_string());
26+
static ref COLLECTION: String = env::var("COLLECTION").unwrap_or_else(|_| "collection".to_string());
2527
static ref CONNECTION_STRING: String =
2628
format!("mongodb://{}:{}/", HOST.as_str(), PORT.as_str());
2729
}
@@ -36,8 +38,8 @@ mod tests {
3638
Ok(c) => c,
3739
Err(e) => panic!("Client Creation Failed: {}", e),
3840
};
39-
40-
let store = MongodbSessionStore::from_client(client, "db_name", "collection");
41+
42+
let store = MongodbSessionStore::from_client(client, &DATABASE, &COLLECTION);
4143
let mut rng = rand::thread_rng();
4244
let n2: u16 = rng.gen();
4345
let key = format!("key-{}", n2);
@@ -53,7 +55,7 @@ mod tests {
5355
}
5456

5557
async fn new() -> async_session::Result {
56-
let store = MongodbSessionStore::new(&CONNECTION_STRING, "db_name", "collection").await?;
58+
let store = MongodbSessionStore::new(&CONNECTION_STRING, &DATABASE, &COLLECTION).await?;
5759

5860
let mut rng = rand::thread_rng();
5961
let n2: u16 = rng.gen();
@@ -70,7 +72,7 @@ mod tests {
7072
}
7173

7274
async fn with_expire() -> async_session::Result {
73-
let store = MongodbSessionStore::new(&CONNECTION_STRING, "db_name", "collection").await?;
75+
let store = MongodbSessionStore::new(&CONNECTION_STRING, &DATABASE, &COLLECTION).await?;
7476

7577
store.initialize().await?;
7678

@@ -92,7 +94,7 @@ mod tests {
9294
async fn check_expired() -> async_session::Result {
9395
use async_std::task;
9496
use std::time::Duration;
95-
let store = MongodbSessionStore::new(&CONNECTION_STRING, "db_name", "collection").await?;
97+
let store = MongodbSessionStore::new(&CONNECTION_STRING, &DATABASE, &COLLECTION).await?;
9698

9799
store.initialize().await?;
98100

0 commit comments

Comments
 (0)