projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Consistent style
[akkoma]
/
test
/
pleroma
/
web
/
o_status
/
o_status_controller_test.exs
diff --git
a/test/pleroma/web/o_status/o_status_controller_test.exs
b/test/pleroma/web/o_status/o_status_controller_test.exs
index ee498f4b555ea10022ac07dbe91f2f6713f88900..f21180a89d12283884c05e80b2f9b04bb7a650a7 100644
(file)
--- a/
test/pleroma/web/o_status/o_status_controller_test.exs
+++ b/
test/pleroma/web/o_status/o_status_controller_test.exs
@@
-7,7
+7,6
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
import Pleroma.Factory
import Pleroma.Factory
- alias Pleroma.Config
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
@@
-21,7
+20,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
:ok
end
:ok
end
- setup do: clear_config([:
instance, :federating], tru
e)
+ setup do: clear_config([:
static_fe, :enabled], fals
e)
describe "Mastodon compatibility routes" do
setup %{conn: conn} do
describe "Mastodon compatibility routes" do
setup %{conn: conn} do
@@
-73,7
+72,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
test "redirects to /notice/id for html format", %{conn: conn} do
note_activity = insert(:note_activity)
test "redirects to /notice/id for html format", %{conn: conn} do
note_activity = insert(:note_activity)
- object = Object.normalize(note_activity)
+ object = Object.normalize(note_activity
, fetch: false
)
[_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"]))
url = "/objects/#{uuid}"
[_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"]))
url = "/objects/#{uuid}"
@@
-83,7
+82,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
test "404s on private objects", %{conn: conn} do
note_activity = insert(:direct_note_activity)
test "404s on private objects", %{conn: conn} do
note_activity = insert(:direct_note_activity)
- object = Object.normalize(note_activity)
+ object = Object.normalize(note_activity
, fetch: false
)
[_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"]))
conn
[_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"]))
conn
@@
-134,7
+133,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
conn: conn
} do
note_activity = insert(:note_activity)
conn: conn
} do
note_activity = insert(:note_activity)
- expected_redirect_url = Object.normalize(note_activity).data["id"]
+ expected_redirect_url = Object.normalize(note_activity
, fetch: false
).data["id"]
redirect_url =
conn
redirect_url =
conn
@@
-215,22
+214,23
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
assert response(conn, 404)
end
assert response(conn, 404)
end
- test "
it requires authentication if instance is NOT federating
", %{
+ test "
does not require authentication on non-federating instances
", %{
conn: conn
} do
conn: conn
} do
-
user = insert(:user
)
+
clear_config([:instance, :federating], false
)
note_activity = insert(:note_activity)
note_activity = insert(:note_activity)
- conn = put_req_header(conn, "accept", "text/html")
-
- ensure_federating_or_authenticated(conn, "/notice/#{note_activity.id}", user)
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/notice/#{note_activity.id}")
+ |> response(200)
end
end
describe "GET /notice/:id/embed_player" do
setup do
note_activity = insert(:note_activity)
end
end
describe "GET /notice/:id/embed_player" do
setup do
note_activity = insert(:note_activity)
- object = Pleroma.Object.normalize(note_activity)
+ object = Pleroma.Object.normalize(note_activity
, fetch: false
)
object_data =
Map.put(object.data, "attachment", [
object_data =
Map.put(object.data, "attachment", [
@@
-287,7
+287,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
test "404s when attachment is empty", %{conn: conn} do
note_activity = insert(:note_activity)
test "404s when attachment is empty", %{conn: conn} do
note_activity = insert(:note_activity)
- object = Pleroma.Object.normalize(note_activity)
+ object = Pleroma.Object.normalize(note_activity
, fetch: false
)
object_data = Map.put(object.data, "attachment", [])
object
object_data = Map.put(object.data, "attachment", [])
object
@@
-301,7
+301,7
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
test "404s when attachment isn't audio or video", %{conn: conn} do
note_activity = insert(:note_activity)
test "404s when attachment isn't audio or video", %{conn: conn} do
note_activity = insert(:note_activity)
- object = Pleroma.Object.normalize(note_activity)
+ object = Pleroma.Object.normalize(note_activity
, fetch: false
)
object_data =
Map.put(object.data, "attachment", [
object_data =
Map.put(object.data, "attachment", [
@@
-325,14
+325,16
@@
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|> response(404)
end
|> response(404)
end
- test "
it requires authentication if instance is NOT federating
", %{
+ test "
does not require authentication on non-federating instances
", %{
conn: conn,
note_activity: note_activity
} do
conn: conn,
note_activity: note_activity
} do
- user = insert(:user)
- conn = put_req_header(conn, "accept", "text/html")
+ clear_config([:instance, :federating], false)
- ensure_federating_or_authenticated(conn, "/notice/#{note_activity.id}/embed_player", user)
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/notice/#{note_activity.id}/embed_player")
+ |> response(200)
end
end
end
end
end
end