activity_pub_test.exs 19.1 KB
Newer Older
lain's avatar
lain committed
1 2 3
defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
  use Pleroma.DataCase
  alias Pleroma.Web.ActivityPub.ActivityPub
lain's avatar
lain committed
4
  alias Pleroma.Web.ActivityPub.Utils
5
  alias Pleroma.Web.CommonAPI
lain's avatar
lain committed
6
  alias Pleroma.{Activity, Object, User}
lain's avatar
lain committed
7
  alias Pleroma.Builders.ActivityBuilder
lain's avatar
lain committed
8

lain's avatar
lain committed
9
  import Pleroma.Factory
Maksim's avatar
Maksim committed
10 11 12 13 14 15
  import Tesla.Mock

  setup do
    mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
    :ok
  end
lain's avatar
lain committed
16

lain's avatar
lain committed
17 18 19 20 21 22
  describe "building a user from his ap id" do
    test "it returns a user" do
      user_id = "http://mastodon.example.org/users/admin"
      {:ok, user} = ActivityPub.make_user_from_ap_id(user_id)
      assert user.ap_id == user_id
      assert user.nickname == "admin@mastodon.example.org"
lain's avatar
lain committed
23 24
      assert user.info.source_data
      assert user.info.ap_enabled
lain's avatar
lain committed
25 26 27 28
      assert user.follower_address == "http://mastodon.example.org/users/admin/followers"
    end
  end

lain's avatar
lain committed
29
  describe "insertion" do
lain's avatar
lain committed
30 31
    test "returns the activity if one with the same id is already in" do
      activity = insert(:note_activity)
lain's avatar
lain committed
32
      {:ok, new_activity} = ActivityPub.insert(activity.data)
lain's avatar
lain committed
33 34 35 36

      assert activity == new_activity
    end

lain's avatar
lain committed
37
    test "inserts a given map into the activity database, giving it an id if it has none." do
lain's avatar
lain committed
38
      data = %{
lain's avatar
lain committed
39
        "ok" => true
lain's avatar
lain committed
40 41 42
      }

      {:ok, %Activity{} = activity} = ActivityPub.insert(data)
lain's avatar
lain committed
43 44 45 46
      assert activity.data["ok"] == data["ok"]
      assert is_binary(activity.data["id"])

      given_id = "bla"
lain's avatar
lain committed
47

lain's avatar
lain committed
48 49
      data = %{
        "ok" => true,
50 51
        "id" => given_id,
        "context" => "blabla"
lain's avatar
lain committed
52 53 54 55 56
      }

      {:ok, %Activity{} = activity} = ActivityPub.insert(data)
      assert activity.data["ok"] == data["ok"]
      assert activity.data["id"] == given_id
57 58 59 60 61 62 63 64 65
      assert activity.data["context"] == "blabla"
      assert activity.data["context_id"]
    end

    test "adds a context when none is there" do
      data = %{
        "id" => "some_id",
        "object" => %{
          "id" => "object_id"
lain's avatar
lain committed
66
        }
67 68 69 70 71 72 73 74
      }

      {:ok, %Activity{} = activity} = ActivityPub.insert(data)

      assert is_binary(activity.data["context"])
      assert is_binary(activity.data["object"]["context"])
      assert activity.data["context_id"]
      assert activity.data["object"]["context_id"]
lain's avatar
lain committed
75
    end
lain's avatar
lain committed
76

lain's avatar
lain committed
77
    test "adds an id to a given object if it lacks one and is a note and inserts it to the object database" do
lain's avatar
lain committed
78 79
      data = %{
        "object" => %{
lain's avatar
lain committed
80
          "type" => "Note",
lain's avatar
lain committed
81 82 83 84 85 86
          "ok" => true
        }
      }

      {:ok, %Activity{} = activity} = ActivityPub.insert(data)
      assert is_binary(activity.data["object"]["id"])
87
      assert %Object{} = Object.get_by_ap_id(activity.data["object"]["id"])
lain's avatar
lain committed
88
    end
lain's avatar
lain committed
89 90
  end

lain's avatar
lain committed
91 92
  describe "create activities" do
    test "removes doubled 'to' recipients" do
eal's avatar
eal committed
93 94
      user = insert(:user)

lain's avatar
lain committed
95 96 97
      {:ok, activity} =
        ActivityPub.create(%{
          to: ["user1", "user1", "user2"],
eal's avatar
eal committed
98
          actor: user,
lain's avatar
lain committed
99 100 101 102
          context: "",
          object: %{}
        })

lain's avatar
lain committed
103
      assert activity.data["to"] == ["user1", "user2"]
eal's avatar
eal committed
104
      assert activity.actor == user.ap_id
lain's avatar
lain committed
105
      assert activity.recipients == ["user1", "user2"]
lain's avatar
lain committed
106 107 108
    end
  end

lain's avatar
lain committed
109 110 111 112
  describe "fetch activities for recipients" do
    test "retrieve the activities for certain recipients" do
      {:ok, activity_one} = ActivityBuilder.insert(%{"to" => ["someone"]})
      {:ok, activity_two} = ActivityBuilder.insert(%{"to" => ["someone_else"]})
lain's avatar
lain committed
113
      {:ok, _activity_three} = ActivityBuilder.insert(%{"to" => ["noone"]})
lain's avatar
lain committed
114 115 116 117 118 119 120

      activities = ActivityPub.fetch_activities(["someone", "someone_else"])
      assert length(activities) == 2
      assert activities == [activity_one, activity_two]
    end
  end

lain's avatar
lain committed
121 122
  describe "fetch activities in context" do
    test "retrieves activities that have a given context" do
123 124 125 126
      {:ok, activity} = ActivityBuilder.insert(%{"type" => "Create", "context" => "2hu"})
      {:ok, activity_two} = ActivityBuilder.insert(%{"type" => "Create", "context" => "2hu"})
      {:ok, _activity_three} = ActivityBuilder.insert(%{"type" => "Create", "context" => "3hu"})
      {:ok, _activity_four} = ActivityBuilder.insert(%{"type" => "Announce", "context" => "2hu"})
127 128
      activity_five = insert(:note_activity)
      user = insert(:user)
lain's avatar
lain committed
129

130
      {:ok, user} = User.block(user, %{ap_id: activity_five.data["actor"]})
lain's avatar
lain committed
131

132
      activities = ActivityPub.fetch_activities_for_context("2hu", %{"blocking_user" => user})
133
      assert activities == [activity_two, activity]
lain's avatar
lain committed
134 135 136
    end
  end

137 138 139
  test "doesn't return blocked activities" do
    activity_one = insert(:note_activity)
    activity_two = insert(:note_activity)
140
    activity_three = insert(:note_activity)
141
    user = insert(:user)
142
    booster = insert(:user)
143 144 145 146 147
    {:ok, user} = User.block(user, %{ap_id: activity_one.data["actor"]})

    activities = ActivityPub.fetch_activities([], %{"blocking_user" => user})

    assert Enum.member?(activities, activity_two)
148
    assert Enum.member?(activities, activity_three)
149 150 151 152 153 154 155
    refute Enum.member?(activities, activity_one)

    {:ok, user} = User.unblock(user, %{ap_id: activity_one.data["actor"]})

    activities = ActivityPub.fetch_activities([], %{"blocking_user" => user})

    assert Enum.member?(activities, activity_two)
156 157 158 159 160 161 162 163 164 165 166 167 168
    assert Enum.member?(activities, activity_three)
    assert Enum.member?(activities, activity_one)

    {:ok, user} = User.block(user, %{ap_id: activity_three.data["actor"]})
    {:ok, _announce, %{data: %{"id" => id}}} = CommonAPI.repeat(activity_three.id, booster)
    %Activity{} = boost_activity = Activity.get_create_activity_by_object_ap_id(id)
    activity_three = Repo.get(Activity, activity_three.id)

    activities = ActivityPub.fetch_activities([], %{"blocking_user" => user})

    assert Enum.member?(activities, activity_two)
    refute Enum.member?(activities, activity_three)
    refute Enum.member?(activities, boost_activity)
169
    assert Enum.member?(activities, activity_one)
lain's avatar
lain committed
170 171 172 173

    activities = ActivityPub.fetch_activities([], %{"blocking_user" => nil})

    assert Enum.member?(activities, activity_two)
174 175
    assert Enum.member?(activities, activity_three)
    assert Enum.member?(activities, boost_activity)
lain's avatar
lain committed
176
    assert Enum.member?(activities, activity_one)
177 178
  end

lain's avatar
lain committed
179
  describe "public fetch activities" do
lain's avatar
lain committed
180 181
    test "doesn't retrieve unlisted activities" do
      user = insert(:user)
lain's avatar
lain committed
182

Maksim's avatar
Maksim committed
183
      {:ok, _unlisted_activity} =
lain's avatar
lain committed
184 185
        CommonAPI.post(user, %{"status" => "yeah", "visibility" => "unlisted"})

lain's avatar
lain committed
186 187 188 189 190 191 192
      {:ok, listed_activity} = CommonAPI.post(user, %{"status" => "yeah"})

      [activity] = ActivityPub.fetch_public_activities()

      assert activity == listed_activity
    end

lain's avatar
lain committed
193
    test "retrieves public activities" do
lain's avatar
lain committed
194
      _activities = ActivityPub.fetch_public_activities()
lain's avatar
lain committed
195

lain's avatar
lain committed
196
      %{public: public} = ActivityBuilder.public_and_non_public()
lain's avatar
lain committed
197

lain's avatar
lain committed
198
      activities = ActivityPub.fetch_public_activities()
lain's avatar
lain committed
199 200 201
      assert length(activities) == 1
      assert Enum.at(activities, 0) == public
    end
lain's avatar
lain committed
202 203 204 205 206

    test "retrieves a maximum of 20 activities" do
      activities = ActivityBuilder.insert_list(30)
      last_expected = List.last(activities)

lain's avatar
lain committed
207
      activities = ActivityPub.fetch_public_activities()
lain's avatar
lain committed
208 209 210 211 212
      last = List.last(activities)

      assert length(activities) == 20
      assert last == last_expected
    end
lain's avatar
lain committed
213 214 215 216 217 218 219

    test "retrieves ids starting from a since_id" do
      activities = ActivityBuilder.insert_list(30)
      later_activities = ActivityBuilder.insert_list(10)
      since_id = List.last(activities).id
      last_expected = List.last(later_activities)

lain's avatar
lain committed
220
      activities = ActivityPub.fetch_public_activities(%{"since_id" => since_id})
lain's avatar
lain committed
221 222 223 224 225
      last = List.last(activities)

      assert length(activities) == 10
      assert last == last_expected
    end
226 227 228 229 230 231 232 233 234 235 236 237 238 239

    test "retrieves ids up to max_id" do
      _first_activities = ActivityBuilder.insert_list(10)
      activities = ActivityBuilder.insert_list(20)
      later_activities = ActivityBuilder.insert_list(10)
      max_id = List.first(later_activities).id
      last_expected = List.last(activities)

      activities = ActivityPub.fetch_public_activities(%{"max_id" => max_id})
      last = List.last(activities)

      assert length(activities) == 20
      assert last == last_expected
    end
lain's avatar
lain committed
240
  end
lain's avatar
lain committed
241

lain's avatar
lain committed
242 243 244 245 246 247 248 249 250 251 252 253
  describe "like an object" do
    test "adds a like activity to the db" do
      note_activity = insert(:note_activity)
      object = Object.get_by_ap_id(note_activity.data["object"]["id"])
      user = insert(:user)
      user_two = insert(:user)

      {:ok, like_activity, object} = ActivityPub.like(user, object)

      assert like_activity.data["actor"] == user.ap_id
      assert like_activity.data["type"] == "Like"
      assert like_activity.data["object"] == object.data["id"]
254
      assert like_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]]
lain's avatar
lain committed
255
      assert like_activity.data["context"] == object.data["context"]
lain's avatar
lain committed
256
      assert object.data["like_count"] == 1
lain's avatar
lain committed
257 258 259 260 261 262 263
      assert object.data["likes"] == [user.ap_id]

      # Just return the original activity if the user already liked it.
      {:ok, same_like_activity, object} = ActivityPub.like(user, object)

      assert like_activity == same_like_activity
      assert object.data["likes"] == [user.ap_id]
lain's avatar
lain committed
264 265 266 267 268 269 270 271 272

      [note_activity] = Activity.all_by_object_ap_id(object.data["id"])
      assert note_activity.data["object"]["like_count"] == 1

      {:ok, _like_activity, object} = ActivityPub.like(user_two, object)
      assert object.data["like_count"] == 2
    end
  end

lain's avatar
lain committed
273 274 275 276 277 278 279 280 281 282 283 284 285
  describe "unliking" do
    test "unliking a previously liked object" do
      note_activity = insert(:note_activity)
      object = Object.get_by_ap_id(note_activity.data["object"]["id"])
      user = insert(:user)

      # Unliking something that hasn't been liked does nothing
      {:ok, object} = ActivityPub.unlike(user, object)
      assert object.data["like_count"] == 0

      {:ok, like_activity, object} = ActivityPub.like(user, object)
      assert object.data["like_count"] == 1

Thog's avatar
Thog committed
286
      {:ok, _, _, object} = ActivityPub.unlike(user, object)
lain's avatar
lain committed
287 288 289 290 291 292
      assert object.data["like_count"] == 0

      assert Repo.get(Activity, like_activity.id) == nil
    end
  end

lain's avatar
lain committed
293 294 295 296 297 298 299 300 301
  describe "announcing an object" do
    test "adds an announce activity to the db" do
      note_activity = insert(:note_activity)
      object = Object.get_by_ap_id(note_activity.data["object"]["id"])
      user = insert(:user)

      {:ok, announce_activity, object} = ActivityPub.announce(user, object)
      assert object.data["announcement_count"] == 1
      assert object.data["announcements"] == [user.ap_id]
lain's avatar
lain committed
302 303 304 305 306 307

      assert announce_activity.data["to"] == [
               User.ap_followers(user),
               note_activity.data["actor"]
             ]

lain's avatar
lain committed
308 309
      assert announce_activity.data["object"] == object.data["id"]
      assert announce_activity.data["actor"] == user.ap_id
lain's avatar
lain committed
310
      assert announce_activity.data["context"] == object.data["context"]
lain's avatar
lain committed
311 312 313
    end
  end

normandy's avatar
normandy committed
314 315 316 317 318 319 320
  describe "unannouncing an object" do
    test "unannouncing a previously announced object" do
      note_activity = insert(:note_activity)
      object = Object.get_by_ap_id(note_activity.data["object"]["id"])
      user = insert(:user)

      # Unannouncing an object that is not announced does nothing
normandy's avatar
normandy committed
321 322
      # {:ok, object} = ActivityPub.unannounce(user, object)
      # assert object.data["announcement_count"] == 0
normandy's avatar
normandy committed
323 324 325 326

      {:ok, announce_activity, object} = ActivityPub.announce(user, object)
      assert object.data["announcement_count"] == 1

327
      {:ok, unannounce_activity, object} = ActivityPub.unannounce(user, object)
normandy's avatar
normandy committed
328 329
      assert object.data["announcement_count"] == 0

330 331
      assert unannounce_activity.data["to"] == [
               User.ap_followers(user),
normandy's avatar
normandy committed
332
               announce_activity.data["actor"]
normandy's avatar
normandy committed
333
             ]
normandy's avatar
normandy committed
334

335
      assert unannounce_activity.data["type"] == "Undo"
336
      assert unannounce_activity.data["object"] == announce_activity.data
337
      assert unannounce_activity.data["actor"] == user.ap_id
normandy's avatar
normandy committed
338
      assert unannounce_activity.data["context"] == announce_activity.data["context"]
339

normandy's avatar
normandy committed
340 341 342 343
      assert Repo.get(Activity, announce_activity.id) == nil
    end
  end

lain's avatar
lain committed
344 345
  describe "uploading files" do
    test "copies the file to the configured folder" do
lain's avatar
lain committed
346 347 348 349 350
      file = %Plug.Upload{
        content_type: "image/jpg",
        path: Path.absname("test/fixtures/image.jpg"),
        filename: "an_image.jpg"
      }
lain's avatar
lain committed
351 352 353 354

      {:ok, %Object{} = object} = ActivityPub.upload(file)
      assert object.data["name"] == "an_image.jpg"
    end
lain's avatar
lain committed
355 356 357

    test "works with base64 encoded images" do
      file = %{
lain's avatar
lain committed
358
        "img" => data_uri()
lain's avatar
lain committed
359 360
      }

lain's avatar
lain committed
361
      {:ok, %Object{}} = ActivityPub.upload(file)
lain's avatar
lain committed
362
    end
lain's avatar
lain committed
363
  end
lain's avatar
lain committed
364

dtluna's avatar
dtluna committed
365 366 367 368 369 370
  describe "fetch the latest Follow" do
    test "fetches the latest Follow activity" do
      %Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)
      follower = Repo.get_by(User, ap_id: activity.data["actor"])
      followed = Repo.get_by(User, ap_id: activity.data["object"])

lain's avatar
lain committed
371
      assert activity == Utils.fetch_latest_follow(follower, followed)
dtluna's avatar
dtluna committed
372 373 374
    end
  end

375
  describe "fetching an object" do
376
    test "it fetches an object" do
lain's avatar
lain committed
377 378 379
      {:ok, object} =
        ActivityPub.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")

380 381 382
      assert activity = Activity.get_create_activity_by_object_ap_id(object.data["id"])
      assert activity.data["id"]

lain's avatar
lain committed
383 384
      {:ok, object_again} =
        ActivityPub.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
385

lain's avatar
lain committed
386 387 388
      assert [attachment] = object.data["attachment"]
      assert is_list(attachment["url"])

389
      assert object == object_again
390
    end
391 392 393 394 395 396

    test "it works with objects only available via Ostatus" do
      {:ok, object} = ActivityPub.fetch_object_from_id("https://shitposter.club/notice/2827873")
      assert activity = Activity.get_create_activity_by_object_ap_id(object.data["id"])
      assert activity.data["id"]

lain's avatar
lain committed
397 398
      {:ok, object_again} =
        ActivityPub.fetch_object_from_id("https://shitposter.club/notice/2827873")
399 400 401

      assert object == object_again
    end
402 403 404 405 406 407 408 409

    test "it correctly stitches up conversations between ostatus and ap" do
      last = "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
      {:ok, object} = ActivityPub.fetch_object_from_id(last)

      object = Object.get_by_ap_id(object.data["inReplyTo"])
      assert object
    end
410 411
  end

412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
  describe "following / unfollowing" do
    test "creates a follow activity" do
      follower = insert(:user)
      followed = insert(:user)

      {:ok, activity} = ActivityPub.follow(follower, followed)
      assert activity.data["type"] == "Follow"
      assert activity.data["actor"] == follower.ap_id
      assert activity.data["object"] == followed.ap_id
    end

    test "creates an undo activity for the last follow" do
      follower = insert(:user)
      followed = insert(:user)

      {:ok, follow_activity} = ActivityPub.follow(follower, followed)
      {:ok, activity} = ActivityPub.unfollow(follower, followed)

      assert activity.data["type"] == "Undo"
      assert activity.data["actor"] == follower.ap_id
432 433 434 435

      assert is_map(activity.data["object"])
      assert activity.data["object"]["type"] == "Follow"
      assert activity.data["object"]["object"] == followed.ap_id
normandy's avatar
normandy committed
436
      assert activity.data["object"]["id"] == follow_activity.data["id"]
437 438 439
    end
  end

440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
  describe "blocking / unblocking" do
    test "creates a block activity" do
      blocker = insert(:user)
      blocked = insert(:user)

      {:ok, activity} = ActivityPub.block(blocker, blocked)

      assert activity.data["type"] == "Block"
      assert activity.data["actor"] == blocker.ap_id
      assert activity.data["object"] == blocked.ap_id
    end

    test "creates an undo activity for the last block" do
      blocker = insert(:user)
      blocked = insert(:user)

      {:ok, block_activity} = ActivityPub.block(blocker, blocked)
      {:ok, activity} = ActivityPub.unblock(blocker, blocked)

      assert activity.data["type"] == "Undo"
      assert activity.data["actor"] == blocker.ap_id

      assert is_map(activity.data["object"])
      assert activity.data["object"]["type"] == "Block"
      assert activity.data["object"]["object"] == blocked.ap_id
      assert activity.data["object"]["id"] == block_activity.data["id"]
    end
  end

lain's avatar
lain committed
469 470 471 472 473 474 475 476 477 478
  describe "deletion" do
    test "it creates a delete activity and deletes the original object" do
      note = insert(:note_activity)
      object = Object.get_by_ap_id(note.data["object"]["id"])
      {:ok, delete} = ActivityPub.delete(object)

      assert delete.data["type"] == "Delete"
      assert delete.data["actor"] == note.data["actor"]
      assert delete.data["object"] == note.data["object"]["id"]

lain's avatar
lain committed
479 480
      assert Repo.get(Activity, delete.id) != nil

lain's avatar
lain committed
481 482 483 484
      assert Repo.get(Object, object.id) == nil
    end
  end

485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
  describe "timeline post-processing" do
    test "it filters broken threads" do
      user1 = insert(:user)
      user2 = insert(:user)
      user3 = insert(:user)

      {:ok, user1} = User.follow(user1, user3)
      assert User.following?(user1, user3)

      {:ok, user2} = User.follow(user2, user3)
      assert User.following?(user2, user3)

      {:ok, user3} = User.follow(user3, user2)
      assert User.following?(user3, user2)

      {:ok, public_activity} = CommonAPI.post(user3, %{"status" => "hi 1"})

kaniini's avatar
kaniini committed
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
      {:ok, private_activity_1} =
        CommonAPI.post(user3, %{"status" => "hi 2", "visibility" => "private"})

      {:ok, private_activity_2} =
        CommonAPI.post(user2, %{
          "status" => "hi 3",
          "visibility" => "private",
          "in_reply_to_status_id" => private_activity_1.id
        })

      {:ok, private_activity_3} =
        CommonAPI.post(user3, %{
          "status" => "hi 4",
          "visibility" => "private",
          "in_reply_to_status_id" => private_activity_2.id
        })
518 519 520

      assert user1.following == [user3.ap_id <> "/followers", user1.ap_id]

kaniini's avatar
kaniini committed
521
      activities = ActivityPub.fetch_activities([user1.ap_id | user1.following])
522 523 524 525 526 527 528 529 530 531 532

      assert [public_activity, private_activity_1, private_activity_3] == activities
      assert length(activities) == 3

      activities = ActivityPub.contain_timeline(activities, user1)

      assert [public_activity, private_activity_1] == activities
      assert length(activities) == 2
    end
  end

Haelwenn's avatar
Haelwenn committed
533 534 535 536 537 538 539 540 541
  test "it can fetch plume articles" do
    {:ok, object} =
      ActivityPub.fetch_object_from_id(
        "https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/"
      )

    assert object
  end

lain's avatar
lain committed
542 543 544 545 546
  describe "update" do
    test "it creates an update activity with the new user data" do
      user = insert(:user)
      {:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user)
      user_data = Pleroma.Web.ActivityPub.UserView.render("user.json", %{user: user})
lain's avatar
lain committed
547 548 549 550 551 552 553 554

      {:ok, update} =
        ActivityPub.update(%{
          actor: user_data["id"],
          to: [user.follower_address],
          cc: [],
          object: user_data
        })
lain's avatar
lain committed
555 556 557 558 559 560 561 562

      assert update.data["actor"] == user.ap_id
      assert update.data["to"] == [user.follower_address]
      assert update.data["object"]["id"] == user_data["id"]
      assert update.data["object"]["type"] == user_data["type"]
    end
  end

Haelwenn's avatar
Haelwenn committed
563 564 565 566 567 568 569 570 571
  test "it can fetch peertube videos" do
    {:ok, object} =
      ActivityPub.fetch_object_from_id(
        "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
      )

    assert object
  end

lain's avatar
lain committed
572
  def data_uri do
lain's avatar
lain committed
573
    File.read!("test/fixtures/avatar_data_uri")
lain's avatar
lain committed
574
  end
lain's avatar
lain committed
575
end