diff options
| author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-06-26 17:41:00 +0000 |
|---|---|---|
| committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-06-26 17:41:00 +0000 |
| commit | bf1c5e255ae0ab297aac3094d6a899c24c29fd2f (patch) | |
| tree | b61c301b4daa6bcb9633dedf09f687d69cf6edf1 /test/web/activity_pub/object_validator_test.exs | |
| parent | 09478c9cf713eefdfdf585f0196efdf00b9c0baf (diff) | |
| parent | 15a8b703185c685fc3d25a381fcb9dee522c78bf (diff) | |
| download | pleroma-bf1c5e255ae0ab297aac3094d6a899c24c29fd2f.tar.gz pleroma-bf1c5e255ae0ab297aac3094d6a899c24c29fd2f.zip | |
Merge branch 'block-handling' into 'develop'
Handle blocks with the pipeline
See merge request pleroma/pleroma!2685
Diffstat (limited to 'test/web/activity_pub/object_validator_test.exs')
| -rw-r--r-- | test/web/activity_pub/object_validator_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validator_test.exs b/test/web/activity_pub/object_validator_test.exs index 770a8dcf8..f38bf7e08 100644 --- a/test/web/activity_pub/object_validator_test.exs +++ b/test/web/activity_pub/object_validator_test.exs @@ -654,4 +654,31 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do assert {:error, _cng} = ObjectValidator.validate(update, []) end end + + describe "blocks" do + setup do + user = insert(:user, local: false) + blocked = insert(:user) + + {:ok, valid_block, []} = Builder.block(user, blocked) + + %{user: user, valid_block: valid_block} + end + + test "validates a basic object", %{ + valid_block: valid_block + } do + assert {:ok, _block, []} = ObjectValidator.validate(valid_block, []) + end + + test "returns an error if we don't know the blocked user", %{ + valid_block: valid_block + } do + block = + valid_block + |> Map.put("object", "https://gensokyo.2hu/users/raymoo") + + assert {:error, _cng} = ObjectValidator.validate(block, []) + end + end end |
