capture where errors are expected
This commit is contained in:
parent
e80f90e9db
commit
56e42602b0
1 changed files with 16 additions and 5 deletions
|
@ -746,7 +746,10 @@ test "it fails for incoming user deletes with spoofed origin" do
|
|||
|> Poison.decode!()
|
||||
|> 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)
|
||||
end
|
||||
|
||||
|
@ -1409,7 +1412,9 @@ test "it rejects activities which reference objects with bogus origins" do
|
|||
"type" => "Announce"
|
||||
}
|
||||
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
assert capture_log(fn ->
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
end) =~ "Object containment failed"
|
||||
end
|
||||
|
||||
test "it rejects activities which reference objects that have an incorrect attribution (variant 1)" do
|
||||
|
@ -1422,7 +1427,9 @@ test "it rejects activities which reference objects that have an incorrect attri
|
|||
"type" => "Announce"
|
||||
}
|
||||
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
assert capture_log(fn ->
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
end) =~ "Object containment failed"
|
||||
end
|
||||
|
||||
test "it rejects activities which reference objects that have an incorrect attribution (variant 2)" do
|
||||
|
@ -1435,7 +1442,9 @@ test "it rejects activities which reference objects that have an incorrect attri
|
|||
"type" => "Announce"
|
||||
}
|
||||
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
assert capture_log(fn ->
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
end) =~ "Object containment failed"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1738,7 +1747,9 @@ test "retunrs not modified object" do
|
|||
|
||||
describe "get_obj_helper/2" 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
|
||||
|
||||
test "returns {:ok, %Object{}} for success case" do
|
||||
|
|
Loading…
Reference in a new issue