This commit is contained in:
parent
4e6e9d803e
commit
c21a792b2b
1 changed files with 27 additions and 1 deletions
|
@ -40,13 +40,14 @@ def test_inbox_follow_request(
|
||||||
|
|
||||||
# send follower request
|
# send follower request
|
||||||
with mock.patch("app.boxes.MANUALLY_APPROVES_FOLLOWERS", False):
|
with mock.patch("app.boxes.MANUALLY_APPROVES_FOLLOWERS", False):
|
||||||
|
follow_id = ap_id + "/follow/" + (uuid4().hex)
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/inbox",
|
"/inbox",
|
||||||
headers={"Content-Type": AP_CONTENT_TYPE},
|
headers={"Content-Type": AP_CONTENT_TYPE},
|
||||||
json={
|
json={
|
||||||
"@context": ap.AS_CTX,
|
"@context": ap.AS_CTX,
|
||||||
"type": "Follow",
|
"type": "Follow",
|
||||||
"id": ap_id + "/follow/" + (uuid4().hex),
|
"id": follow_id,
|
||||||
"actor": ap_id,
|
"actor": ap_id,
|
||||||
"object": ap.ME["id"],
|
"object": ap.ME["id"],
|
||||||
},
|
},
|
||||||
|
@ -65,6 +66,31 @@ def test_inbox_follow_request(
|
||||||
follower_actor = db.execute(select(models.Follower)).scalar_one()
|
follower_actor = db.execute(select(models.Follower)).scalar_one()
|
||||||
assert follower_actor.ap_actor_id == ap_id
|
assert follower_actor.ap_actor_id == ap_id
|
||||||
|
|
||||||
|
# send undo follower request
|
||||||
|
with mock.patch("app.boxes.MANUALLY_APPROVES_FOLLOWERS", False):
|
||||||
|
undo_id = ap_id + "/undo/" + (uuid4().hex)
|
||||||
|
response = client.post(
|
||||||
|
"/inbox",
|
||||||
|
headers={"Content-Type": AP_CONTENT_TYPE},
|
||||||
|
json={
|
||||||
|
"@context": ap.AS_CTX,
|
||||||
|
"type": "Undo",
|
||||||
|
"id": undo_id,
|
||||||
|
"actor": ap_id,
|
||||||
|
"object": {
|
||||||
|
"type": "Follow",
|
||||||
|
"id": follow_id,
|
||||||
|
"actor": ap_id,
|
||||||
|
"object": ap.ME["id"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert response.status_code == 202
|
||||||
|
|
||||||
|
# follower was not saved in follower table
|
||||||
|
follower_actor = db.execute(select(models.Follower)).scalar_one_or_none()
|
||||||
|
assert follower_actor == None
|
||||||
|
|
||||||
|
|
||||||
def test_inbox_announce_request(
|
def test_inbox_announce_request(
|
||||||
db: Session,
|
db: Session,
|
||||||
|
|
Loading…
Reference in a new issue