mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
feat: setup and run tests for sqlx postgres
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user