use dialtone_common::ap::ActorType; use dialtone_sqlx::control::actor::create_owned::create_credentialed_actor; use dialtone_sqlx::control::user::create::create_user; use dialtone_sqlx::db::actor_owner::fetch_authz::fetch_actor_owner_authz; use dialtone_sqlx::logic::actor::new_actor::NewActor; use dialtone_test_util::{test_action, test_pg}; #[tokio::test] async fn fetch_actor_owner_authz_test() { test_pg::test_pg(move |pool| async move { let acct = "test@example.com"; let action = create_user(&pool, acct, "secretpassword").await; assert!(action.is_ok()); let new_actor = NewActor { preferred_user_name: "test_user", actor_type: ActorType::Person, owner: acct, name: None, summary: None, icon: None, image: None, }; let action = create_credentialed_actor(&pool, new_actor, true, "example.com").await; test_action!(action); let actor = action.unwrap(); let action = fetch_actor_owner_authz(&pool, &actor.owned_actor.ap.id, acct).await; test_action!(action); let authorized = action.unwrap(); assert!(authorized); }) .await; }