From a1f801c1d20e1d20c575d27849f0cc01f16afd75 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Thu, 3 Aug 2023 20:59:58 +0800 Subject: [PATCH] [test] add follow in/outbox object tests --- tests/test_inbox.py | 7 ++++++- tests/test_outbox.py | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_inbox.py b/tests/test_inbox.py index 39c587e..3de94ee 100644 --- a/tests/test_inbox.py +++ b/tests/test_inbox.py @@ -52,13 +52,18 @@ def test_inbox_follow_request( saved_actor = db.execute(select(models.Actor)).scalar_one() assert saved_actor.ap_id == ap_id - # follower request was saved in outbox table + # follow request was saved in inbox table + inbox_object = db.execute(select(models.InboxObject)).scalar_one() + assert inbox_object.ap_type == "Follow" + + # follow accept response was saved in outbox table outbox_object = db.execute(select(models.OutboxObject)).scalar_one() assert outbox_object.ap_type == "Accept" # follower was saved in follower table follower_actor = db.execute(select(models.Follower)).scalar_one() assert follower_actor.ap_actor_id == ap_id + assert follower_actor.inbox_object == inbox_object # send undo follower request with mock.patch("app.boxes.MANUALLY_APPROVES_FOLLOWERS", False): diff --git a/tests/test_outbox.py b/tests/test_outbox.py index 0b038a7..97239ee 100644 --- a/tests/test_outbox.py +++ b/tests/test_outbox.py @@ -62,6 +62,12 @@ async def test_outbox_send_follow_request( # follower was saved in follower table following_actor = db.execute(select(models.Following)).scalar_one() assert following_actor.ap_actor_id == remote_ap_id + assert following_actor.outbox_object == outbox_object + + inbox_object = db.execute(select(models.InboxObject)).scalar_one() + assert inbox_object.ap_type == "Accept" + + @pytest.mark.asyncio