dialtone_sqlx 0.1.0

Dialtone SQLx Back-End
Documentation
use dialtone_common::ap::{Actor, ActorType, PublicKey};
use dialtone_common::rest::actors::actor_model::OwnedActor;
use dialtone_sqlx::control::actor::create::create_actor;
use dialtone_test_util::{test_action, test_pg};
use sqlx::types::chrono::Utc;

#[tokio::test]
async fn create_actor_test() {
    test_pg::test_pg(move |pool| async move {
        let actor = Actor {
            ap_type: ActorType::Person,
            id: "https://example.com/bob".to_string(),
            preferred_user_name: "bobby joe".to_string(),
            name: None,
            summary: None,
            icon: None,
            image: None,
            following: None,
            followers: None,
            liked: None,
            likes: None,
            inbox: None,
            outbox: None,
            public_key: PublicKey {
                id: "https://example.com/bob#key".to_string(),
                owner: "https://example.com/bob".to_string(),
                public_key_pem: "---- BEGIN PUBLIC KEY ----- blah blah blah".to_string(),
            },
            endpoints: None,
        };
        let actor_info = OwnedActor {
            ap: actor,
            jrd: None,
            owner_data: None,
            created_at: Utc::now(),
            modified_at: Utc::now(),
        };
        let action = create_actor(&pool, &actor_info).await;
        test_action!(action);
    })
    .await;
}