logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

note_validator_test.exs (914B)


      1 # Pleroma: A lightweight social networking server
      2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
      3 # SPDX-License-Identifier: AGPL-3.0-only
      4 
      5 defmodule Pleroma.Web.ActivityPub.ObjectValidators.NoteValidatorTest do
      6   use Pleroma.DataCase
      7 
      8   alias Pleroma.Web.ActivityPub.ObjectValidators.NoteValidator
      9   alias Pleroma.Web.ActivityPub.Utils
     10 
     11   import Pleroma.Factory
     12 
     13   describe "Notes" do
     14     setup do
     15       user = insert(:user)
     16 
     17       note = %{
     18         "id" => Utils.generate_activity_id(),
     19         "type" => "Note",
     20         "actor" => user.ap_id,
     21         "to" => [user.follower_address],
     22         "cc" => [],
     23         "content" => "Hellow this is content.",
     24         "context" => "xxx",
     25         "summary" => "a post"
     26       }
     27 
     28       %{user: user, note: note}
     29     end
     30 
     31     test "a basic note validates", %{note: note} do
     32       %{valid?: true} = NoteValidator.cast_and_validate(note)
     33     end
     34   end
     35 end