Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85595537
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/test/pleroma/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs
index 6c80f76d0..a5b323362 100644
--- a/test/pleroma/web/web_finger/web_finger_controller_test.exs
+++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs
@@ -40,15 +40,33 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
end
end
+ defp webfinger_xml_response(conn, status) do
+ content_type = if status not in [400, 404] do
+ conn
+ |> Plug.Conn.get_resp_header("content-type")
+ |> List.first()
+ |> String.split(";")
+ |> List.first()
+ end
+
+ status = Plug.Conn.Status.code(status)
+
+ if status == 200 do
+ assert content_type == "application/xrd+xml"
+ response(conn, status)
+ else
+ response(conn, status)
+ end
+ end
+
test "GET host-meta" do
response =
build_conn()
|> get("/.well-known/host-meta")
-
- assert response.status == 200
+ |> webfinger_xml_response(200)
response_xml =
- response.resp_body
+ response
|> Floki.parse_document!(html_parser: Floki.HTMLParser.Mochiweb, attributes_as_maps: true)
expected_xml =
@@ -94,7 +112,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
build_conn()
|> put_req_header("accept", "application/xrd+xml")
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
- |> response(200)
+ |> webfinger_xml_response(200)
assert response =~ "<Alias>https://hyrule.world/users/zelda</Alias>"
end
@@ -166,7 +184,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
build_conn()
|> put_req_header("accept", "application/xrd+xml")
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
- |> response(200)
+ |> webfinger_xml_response(200)
assert response =~ "<Alias>https://hyrule.world/users/zelda</Alias>"
assert response =~ "<Alias>https://mushroom.kingdom/users/toad</Alias>"
@@ -207,7 +225,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
build_conn()
|> put_req_header("accept", "application/xrd+xml")
|> get("/.well-known/webfinger?resource=acct:jimm@localhost")
- |> response(404)
+ |> webfinger_xml_response(404)
assert result == "Couldn't find user"
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jul 19, 12:03 PM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1695254
Default Alt Text
(2 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment