use dialtone_reqwest::api_v1::ap_objects::get_sysinfo::get_ap_object_sysinfo; use dialtone_test_util::create_ap_object::create_article_for_actor_tst_utl; use dialtone_test_util::create_system::create_system_tst_utl; use dialtone_test_util::test_action; use dialtone_test_util::test_constants::{TEST_CONTENTADMIN_NAME, TEST_NOROLEUSER_NAME, TEST_PASSWORD}; use dialtone_test_util::test_pg::test_pg; use dialtone_test_util::test_server::start_test_srv_and_auth; #[tokio::test] #[allow(non_snake_case)] async fn GIVEN_ap_object_and_owner_WHEN_get_sysinfo_THEN_error() { test_pg(move |pool| async move { // GIVEN let actors = create_system_tst_utl(&pool).await; let actor_id = actors.no_role_actor.owned_actor.ap.id; let ap_object = create_article_for_actor_tst_utl(&pool, &actor_id, "foo").await; let ap_object_id = ap_object.id.unwrap(); let sc = start_test_srv_and_auth(pool, TEST_NOROLEUSER_NAME, TEST_PASSWORD).await; // WHEN let action = get_ap_object_sysinfo(&sc, &ap_object_id).await; // THEN assert!(action.is_err()); }) .await; } #[tokio::test] #[allow(non_snake_case)] async fn GIVEN_ap_object_and_contentadmin_WHEN_get_sysinfo_THEN_success() { test_pg(move |pool| async move { // GIVEN let actors = create_system_tst_utl(&pool).await; let actor_id = actors.no_role_actor.owned_actor.ap.id; let ap_object = create_article_for_actor_tst_utl(&pool, &actor_id, "foo").await; let ap_object_id = ap_object.id.unwrap(); let sc = start_test_srv_and_auth(pool, TEST_CONTENTADMIN_NAME, TEST_PASSWORD).await; // WHEN let action = get_ap_object_sysinfo(&sc, &ap_object_id).await; // THEN test_action!(action); }) .await; }