diff options
| author | William Pitcock <nenolod@dereferenced.org> | 2018-12-04 05:00:11 +0000 | 
|---|---|---|
| committer | William Pitcock <nenolod@dereferenced.org> | 2018-12-04 05:00:11 +0000 | 
| commit | 419d4bd5e43248957ea66039231e3389c608368d (patch) | |
| tree | 2e668e3b8b80db77ee3444bf18bb5a756dad791b /test | |
| parent | b3b52b58c3b31b22d3b3227d06d9a5336fa8edd0 (diff) | |
| download | pleroma-419d4bd5e43248957ea66039231e3389c608368d.tar.gz pleroma-419d4bd5e43248957ea66039231e3389c608368d.zip | |
tests: add tests for Object.normalize()
Diffstat (limited to 'test')
| -rw-r--r-- | test/object_test.exs | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/test/object_test.exs b/test/object_test.exs index 909605560..3907748f7 100644 --- a/test/object_test.exs +++ b/test/object_test.exs @@ -49,4 +49,22 @@ defmodule Pleroma.ObjectTest do        refute object == cached_object      end    end + +  describe "normalizer" do +    test "fetches unknown objects by default" do +      %Object{} = object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367") + +      assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367" +    end + +    test "fetches unknown objects when fetch_remote is explicitly true" do +      %Object{} = object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367", true) + +      assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367" +    end + +    test "does not fetch unknown objects when fetch_remote is false" do +      assert is_nil(Object.normalize("http://mastodon.example.org/@admin/99541947525187367", false)) +    end +  end  end | 
