Merge branch 'transmogrifier-test-errors' into 'develop'

capture test log where errors are expected

See merge request pleroma/pleroma!1915
This commit is contained in:
lain 2019-11-04 15:19:29 +00:00
commit a304a2a845
1 changed files with 16 additions and 5 deletions

View File

@ -747,7 +747,10 @@ test "it fails for incoming user deletes with spoofed origin" do
|> Poison.decode!() |> Poison.decode!()
|> Map.put("actor", ap_id) |> Map.put("actor", ap_id)
assert :error == Transmogrifier.handle_incoming(data) assert capture_log(fn ->
assert :error == Transmogrifier.handle_incoming(data)
end) =~ "Object containment failed"
assert User.get_cached_by_ap_id(ap_id) assert User.get_cached_by_ap_id(ap_id)
end end
@ -1437,7 +1440,9 @@ test "it rejects activities which reference objects with bogus origins" do
"type" => "Announce" "type" => "Announce"
} }
:error = Transmogrifier.handle_incoming(data) assert capture_log(fn ->
:error = Transmogrifier.handle_incoming(data)
end) =~ "Object containment failed"
end end
test "it rejects activities which reference objects that have an incorrect attribution (variant 1)" do test "it rejects activities which reference objects that have an incorrect attribution (variant 1)" do
@ -1450,7 +1455,9 @@ test "it rejects activities which reference objects that have an incorrect attri
"type" => "Announce" "type" => "Announce"
} }
:error = Transmogrifier.handle_incoming(data) assert capture_log(fn ->
:error = Transmogrifier.handle_incoming(data)
end) =~ "Object containment failed"
end end
test "it rejects activities which reference objects that have an incorrect attribution (variant 2)" do test "it rejects activities which reference objects that have an incorrect attribution (variant 2)" do
@ -1463,7 +1470,9 @@ test "it rejects activities which reference objects that have an incorrect attri
"type" => "Announce" "type" => "Announce"
} }
:error = Transmogrifier.handle_incoming(data) assert capture_log(fn ->
:error = Transmogrifier.handle_incoming(data)
end) =~ "Object containment failed"
end end
end end
@ -1766,7 +1775,9 @@ test "retunrs not modified object" do
describe "get_obj_helper/2" do describe "get_obj_helper/2" do
test "returns nil when cannot normalize object" do test "returns nil when cannot normalize object" do
refute Transmogrifier.get_obj_helper("test-obj-id") assert capture_log(fn ->
refute Transmogrifier.get_obj_helper("test-obj-id")
end) =~ "Unsupported URI scheme"
end end
test "returns {:ok, %Object{}} for success case" do test "returns {:ok, %Object{}} for success case" do