FollowTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Tests\Unit\ActivityPub\Verb;
  3. use Tests\TestCase;
  4. use Illuminate\Foundation\Testing\WithFaker;
  5. use Illuminate\Foundation\Testing\RefreshDatabase;
  6. use App\Util\ActivityPub\Validator\Follow;
  7. class FollowTest extends TestCase
  8. {
  9. public function setUp(): void
  10. {
  11. parent::setUp();
  12. $this->basicFollow = [
  13. "type" => "Follow",
  14. "signature" => [
  15. "type" => "RsaSignature2017",
  16. "signatureValue" => "Kn1/UkAQGJVaXBfWLAHcnwHg8YMAUqlEaBuYLazAG+pz5hqivsyrBmPV186Xzr+B4ZLExA9+SnOoNx/GOz4hBm0kAmukNSILAsUd84tcJ2yT9zc1RKtembK4WiwOw7li0+maeDN0HaB6t+6eTqsCWmtiZpprhXD8V1GGT8yG7X24fQ9oFGn+ng7lasbcCC0988Y1eGqNe7KryxcPuQz57YkDapvtONzk8gyLTkZMV4De93MyRHq6GVjQVIgtiYabQAxrX6Q8C+4P/jQoqdWJHEe+MY5JKyNaT/hMPt2Md1ok9fZQBGHlErk22/zy8bSN19GdG09HmIysBUHRYpBLig==",
  17. "creator" => "http://mastodon.example.org/users/admin#main-key",
  18. "created" => "2018-02-17T13:29:31Z",
  19. ],
  20. "object" => "http://pixelfed.dev/users/dsup",
  21. "nickname" => "dsup",
  22. "id" => "http://mastodon.example.org/users/admin#follows/2",
  23. "actor" => "http://mastodon.example.org/users/admin",
  24. "@context" => [
  25. "https://www.w3.org/ns/activitystreams",
  26. "https://w3id.org/security/v1",
  27. [
  28. "toot" => "http://joinmastodon.org/ns#",
  29. "sensitive" => "as:sensitive",
  30. "ostatus" => "http://ostatus.org#",
  31. "movedTo" => "as:movedTo",
  32. "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
  33. "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
  34. "conversation" => "ostatus:conversation",
  35. "atomUri" => "ostatus:atomUri",
  36. "Hashtag" => "as:Hashtag",
  37. "Emoji" => "toot:Emoji",
  38. ],
  39. ],
  40. ];
  41. }
  42. /** @test */
  43. public function basic_follow()
  44. {
  45. $this->assertTrue(Follow::validate($this->basicFollow));
  46. }
  47. }