diff options
author | feld <feld@feld.me> | 2020-12-07 22:49:45 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2020-12-07 22:49:45 +0000 |
commit | 9d0839504e5a3b11dcdf7686c3526c7cb3a6178c (patch) | |
tree | 5e52bf9b1f21362944e8240e4803b531e63e6914 /test | |
parent | ed76323776f2506cfefbe78c369fdb7ccfe3b650 (diff) | |
parent | 1403798820da21660fb8787ffaf9f54817597636 (diff) | |
download | pleroma-9d0839504e5a3b11dcdf7686c3526c7cb3a6178c.tar.gz pleroma-9d0839504e5a3b11dcdf7686c3526c7cb3a6178c.zip |
Merge branch 'features/favicon-unreachable-instance' into 'develop'
instance: Do not fetch unreachable instances
Closes #2346
See merge request pleroma/pleroma!3189
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/instances/instance_test.exs | 9 | ||||
-rw-r--r-- | test/pleroma/instances_test.exs | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/test/pleroma/instances/instance_test.exs b/test/pleroma/instances/instance_test.exs index 4f0805100..2c6389e4f 100644 --- a/test/pleroma/instances/instance_test.exs +++ b/test/pleroma/instances/instance_test.exs @@ -3,6 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Instances.InstanceTest do + alias Pleroma.Instances alias Pleroma.Instances.Instance alias Pleroma.Repo @@ -148,5 +149,13 @@ defmodule Pleroma.Instances.InstanceTest do ) end) =~ "Instance.scrape_favicon(\"https://no-favicon.example.org/\") error: " end + + test "Doesn't scrapes unreachable instances" do + instance = insert(:instance, unreachable_since: Instances.reachability_datetime_threshold()) + url = "https://" <> instance.host + + assert capture_log(fn -> assert nil == Instance.get_or_update_favicon(URI.parse(url)) end) =~ + "Instance.scrape_favicon(\"#{url}\") ignored unreachable host" + end end end diff --git a/test/pleroma/instances_test.exs b/test/pleroma/instances_test.exs index d2618025c..5d0ce6237 100644 --- a/test/pleroma/instances_test.exs +++ b/test/pleroma/instances_test.exs @@ -32,9 +32,9 @@ defmodule Pleroma.InstancesTest do assert Instances.reachable?(URI.parse(url).host) end - test "returns true on non-binary input" do - assert Instances.reachable?(nil) - assert Instances.reachable?(1) + test "raises FunctionClauseError exception on non-binary input" do + assert_raise FunctionClauseError, fn -> Instances.reachable?(nil) end + assert_raise FunctionClauseError, fn -> Instances.reachable?(1) end end end |