cyrtophora

Full-stack users-first, secure web framework.
git clone https://gitlab.com/kwatafana/cyrtophora.git
Log | Files | Refs | README

commit 069177e8645d0784b7558be9dca89334c8009fab
parent 16d557b2ea782dfd9bdd5be92b0da4763753e6ab
Author: Jackson G. Kaindume <kaindume@kwatafana.org>
Date:   Thu, 22 Sep 2022 15:38:36 +0200

[phora] Rename `Cyrtophora::new_sqlite()` attribute

Renamed the `path` attribute to `db_path`

Diffstat:
Mphora/src/lib.rs | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/phora/src/lib.rs b/phora/src/lib.rs @@ -17,9 +17,9 @@ where impl<D: DB> Cyrtophora<D> { #[cfg(feature = "sqlite")] pub fn new_sqlite( - path: &str, + db_path: &str, ) -> Result<Cyrtophora<database::sqlite::SqliteDB>, database::error::Error> { - let mut db = database::sqlite::SqliteDB::new(path); + let mut db = database::sqlite::SqliteDB::new(db_path); db.connect()?; let c = Cyrtophora { database: Some(db) }; Ok(c) @@ -56,3 +56,22 @@ impl<D: DB> Cyrtophora<D> { } } } + +#[cfg(test)] +mod test { + use super::*; + + const TEST_DB_PATH: &str = "test-data/ACCOUNTS.db"; + + #[test] + #[cfg(feature = "sqlite")] + fn test_new_sqlite() { + let cyrtophora = + Cyrtophora::<database::sqlite::SqliteDB>::new_sqlite(TEST_DB_PATH).unwrap(); + + match cyrtophora.database { + Some(_conn) => assert!(true), + _ => assert!(false), + } + } +}