feat: setup and run tests for sqlx postgres

This commit is contained in:
realaravinth
2022-05-11 13:09:47 +05:30
parent 79cc28bfd8
commit 3a80281e86

View File

@@ -14,14 +14,32 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
//use sqlx::postgres::PgPoolOptions; use sqlx::postgres::PgPoolOptions;
//use std::env; use std::env;
//
//use crate::*; use crate::*;
//
//use db_core::tests::*; use db_core::prelude::*;
// use db_core::tests::*;
//#[actix_rt::test]
//async fn everyting_works() { #[actix_rt::test]
// unimplemented!(); async fn everyting_works() {
//} const EMAIL: &str = "postgresuser@foo.com";
const NAME: &str = "postgresuser";
const PASSWORD: &str = "pasdfasdfasdfadf";
const SECRET1: &str = "postgressecret1";
let url = env::var("POSTGRES_DATABASE_URL").unwrap();
let pool_options = PgPoolOptions::new().max_connections(2);
let connection_options = ConnectionOptions::Fresh(Fresh { pool_options, url });
let db = connection_options.connect().await.unwrap();
db.migrate().await.unwrap();
let p = Register {
username: NAME,
email: Some(EMAIL),
hash: PASSWORD,
secret: SECRET1,
};
database_works(&db, &p).await;
}