use dialtone_sqlx::control::user::create_with_actor::create_user_with_default_actor; use dialtone_sqlx::db::user_principal::check_name_available::check_user_name_available; use dialtone_test_util::{test_action, test_pg}; #[tokio::test] async fn check_user_name_available_test() { test_pg::test_pg(move |pool| async move { let action = check_user_name_available( &pool, "test_user@example.com", &["https://example.com/test_user"], ) .await; test_action!(action); assert!(action.unwrap()) }) .await; } #[tokio::test] async fn fail_check_user_name_available_test() { test_pg::test_pg(move |pool| async move { let action = create_user_with_default_actor(&pool, "test_user", "example.com", "secretpassword") .await; assert!(action.is_ok()); let action = check_user_name_available( &pool, "test_user@example.com", &["https://example.com/test_user"], ) .await; test_action!(action); assert!(!action.unwrap()) }) .await; }