Fix test warnings

warning: the URI path used in plug tests must start with "/"
This commit is contained in:
Mark Felder 2023-05-31 16:30:31 -04:00
parent 62322f71e2
commit ba988a9abc
2 changed files with 17 additions and 17 deletions

View File

@ -37,7 +37,7 @@ test "posting a status does not increment reblog_count when relaying", %{conn: c
response = response =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{ |> post("/api/v1/statuses", %{
"content_type" => "text/plain", "content_type" => "text/plain",
"source" => "Pleroma FE", "source" => "Pleroma FE",
"status" => "Hello world", "status" => "Hello world",
@ -50,7 +50,7 @@ test "posting a status does not increment reblog_count when relaying", %{conn: c
response = response =
conn conn
|> get("api/v1/statuses/#{response["id"]}", %{}) |> get("/api/v1/statuses/#{response["id"]}", %{})
|> json_response_and_validate_schema(200) |> json_response_and_validate_schema(200)
assert response["reblogs_count"] == 0 assert response["reblogs_count"] == 0
@ -109,7 +109,7 @@ test "posting a status", %{conn: conn} do
conn_four = conn_four =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{ |> post("/api/v1/statuses", %{
"status" => "oolong", "status" => "oolong",
"expires_in" => expires_in "expires_in" => expires_in
}) })
@ -134,7 +134,7 @@ test "it fails to create a status if `expires_in` is less or equal than an hour"
assert %{"error" => "Expiry date is too soon"} = assert %{"error" => "Expiry date is too soon"} =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{ |> post("/api/v1/statuses", %{
"status" => "oolong", "status" => "oolong",
"expires_in" => expires_in "expires_in" => expires_in
}) })
@ -146,7 +146,7 @@ test "it fails to create a status if `expires_in` is less or equal than an hour"
assert %{"error" => "Expiry date is too soon"} = assert %{"error" => "Expiry date is too soon"} =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{ |> post("/api/v1/statuses", %{
"status" => "oolong", "status" => "oolong",
"expires_in" => expires_in "expires_in" => expires_in
}) })
@ -160,7 +160,7 @@ test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} = assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{"status" => "GNO/Linux"}) |> post("/api/v1/statuses", %{"status" => "GNO/Linux"})
|> json_response_and_validate_schema(422) |> json_response_and_validate_schema(422)
end end
@ -353,7 +353,7 @@ test "posting a direct status", %{conn: conn} do
conn = conn =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{"status" => content, "visibility" => "direct"}) |> post("/api/v1/statuses", %{"status" => content, "visibility" => "direct"})
assert %{"id" => id} = response = json_response_and_validate_schema(conn, 200) assert %{"id" => id} = response = json_response_and_validate_schema(conn, 200)
assert response["visibility"] == "direct" assert response["visibility"] == "direct"
@ -390,7 +390,7 @@ test "discloses application metadata when enabled" do
result = result =
conn conn
|> get("api/v1/statuses/#{activity}") |> get("/api/v1/statuses/#{activity}")
assert %{ assert %{
"content" => "cofe is my copilot", "content" => "cofe is my copilot",
@ -419,7 +419,7 @@ test "hides application metadata when disabled" do
result = result =
conn conn
|> get("api/v1/statuses/#{activity}") |> get("/api/v1/statuses/#{activity}")
assert %{ assert %{
"content" => "club mate is my wingman", "content" => "club mate is my wingman",
@ -1334,7 +1334,7 @@ test "on pin removes deletion job, on unpin reschedule deletion" do
assert %{"id" => id} = assert %{"id" => id} =
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("api/v1/statuses", %{ |> post("/api/v1/statuses", %{
"status" => "oolong", "status" => "oolong",
"expires_in" => expires_in "expires_in" => expires_in
}) })
@ -1584,7 +1584,7 @@ test "Repeated posts that are replies incorrectly have in_reply_to_id null", %{c
conn conn
|> assign(:user, user3) |> assign(:user, user3)
|> assign(:token, insert(:oauth_token, user: user3, scopes: ["read:statuses"])) |> assign(:token, insert(:oauth_token, user: user3, scopes: ["read:statuses"]))
|> get("api/v1/timelines/home") |> get("/api/v1/timelines/home")
[reblogged_activity] = json_response_and_validate_schema(conn3, 200) [reblogged_activity] = json_response_and_validate_schema(conn3, 200)

View File

@ -527,7 +527,7 @@ test "direct timeline", %{conn: conn} do
|> assign(:token, insert(:oauth_token, user: user_two, scopes: ["read:statuses"])) |> assign(:token, insert(:oauth_token, user: user_two, scopes: ["read:statuses"]))
# Only direct should be visible here # Only direct should be visible here
res_conn = get(conn_user_two, "api/v1/timelines/direct") res_conn = get(conn_user_two, "/api/v1/timelines/direct")
assert [status] = json_response_and_validate_schema(res_conn, :ok) assert [status] = json_response_and_validate_schema(res_conn, :ok)
@ -539,14 +539,14 @@ test "direct timeline", %{conn: conn} do
build_conn() build_conn()
|> assign(:user, user_one) |> assign(:user, user_one)
|> assign(:token, insert(:oauth_token, user: user_one, scopes: ["read:statuses"])) |> assign(:token, insert(:oauth_token, user: user_one, scopes: ["read:statuses"]))
|> get("api/v1/timelines/direct") |> get("/api/v1/timelines/direct")
[status] = json_response_and_validate_schema(res_conn, :ok) [status] = json_response_and_validate_schema(res_conn, :ok)
assert %{"visibility" => "direct"} = status assert %{"visibility" => "direct"} = status
# Both should be visible here # Both should be visible here
res_conn = get(conn_user_two, "api/v1/timelines/home") res_conn = get(conn_user_two, "/api/v1/timelines/home")
[_s1, _s2] = json_response_and_validate_schema(res_conn, :ok) [_s1, _s2] = json_response_and_validate_schema(res_conn, :ok)
@ -559,14 +559,14 @@ test "direct timeline", %{conn: conn} do
}) })
end) end)
res_conn = get(conn_user_two, "api/v1/timelines/direct") res_conn = get(conn_user_two, "/api/v1/timelines/direct")
statuses = json_response_and_validate_schema(res_conn, :ok) statuses = json_response_and_validate_schema(res_conn, :ok)
assert length(statuses) == 20 assert length(statuses) == 20
max_id = List.last(statuses)["id"] max_id = List.last(statuses)["id"]
res_conn = get(conn_user_two, "api/v1/timelines/direct?max_id=#{max_id}") res_conn = get(conn_user_two, "/api/v1/timelines/direct?max_id=#{max_id}")
assert [status] = json_response_and_validate_schema(res_conn, :ok) assert [status] = json_response_and_validate_schema(res_conn, :ok)
@ -591,7 +591,7 @@ test "doesn't include DMs from blocked users" do
visibility: "direct" visibility: "direct"
}) })
res_conn = get(conn, "api/v1/timelines/direct") res_conn = get(conn, "/api/v1/timelines/direct")
[status] = json_response_and_validate_schema(res_conn, :ok) [status] = json_response_and_validate_schema(res_conn, :ok)
assert status["id"] == direct.id assert status["id"] == direct.id