use dialtone_common::rest::users::web_user::UserStatus; use dialtone_sqlx::db::user_principal::change_status::change_user_status; use dialtone_sqlx::db::user_principal::create_user; use dialtone_sqlx::db::user_principal::fetch_info::fetch_user_info; use dialtone_test_util::test_pg; #[tokio::test] async fn change_user_status_test() { test_pg::test_pg(move |pool| async move { let acct = "test@example.com"; let password = "secretpassword"; create_user(&pool, acct, password).await.unwrap(); let action = fetch_user_info(&pool, acct).await; assert!(action.is_ok()); assert_eq!(action.unwrap().unwrap().status, UserStatus::PendingApproval); let action = change_user_status(&pool, acct, &UserStatus::Active).await; println!("{:?}", action); assert!(action.is_ok()); assert!(action.unwrap().is_some()); let action = fetch_user_info(&pool, acct).await; assert!(action.is_ok()); assert_eq!(action.unwrap().unwrap().status, UserStatus::Active); }) .await; }