Merge develop branch upstream
This commit is contained in:
commit
5d279a22b1
113 changed files with 909 additions and 560 deletions
|
|
@ -6,7 +6,7 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadataTest do
|
|||
use Pleroma.DataCase, async: true
|
||||
alias Pleroma.Upload.Filter.AnalyzeMetadata
|
||||
|
||||
test "adds the image dimensions" do
|
||||
test "adds the dimensions and blurhash for images" do
|
||||
upload = %Pleroma.Upload{
|
||||
name: "an… image.jpg",
|
||||
content_type: "image/jpeg",
|
||||
|
|
@ -14,6 +14,20 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadataTest do
|
|||
tempfile: Path.absname("test/fixtures/image.jpg")
|
||||
}
|
||||
|
||||
assert {:ok, :filtered, %{width: 1024, height: 768}} = AnalyzeMetadata.filter(upload)
|
||||
{:ok, :filtered, meta} = AnalyzeMetadata.filter(upload)
|
||||
|
||||
assert %{width: 1024, height: 768} = meta
|
||||
assert meta.blurhash
|
||||
end
|
||||
|
||||
test "adds the dimensions for videos" do
|
||||
upload = %Pleroma.Upload{
|
||||
name: "coolvideo.mp4",
|
||||
content_type: "video/mp4",
|
||||
path: Path.absname("test/fixtures/video.mp4"),
|
||||
tempfile: Path.absname("test/fixtures/video.mp4")
|
||||
}
|
||||
|
||||
assert {:ok, :filtered, %{width: 480, height: 480}} = AnalyzeMetadata.filter(upload)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1639,9 +1639,9 @@ defmodule Pleroma.UserTest do
|
|||
follower_count: 9,
|
||||
following_count: 9001,
|
||||
is_locked: true,
|
||||
is_confirmed: false,
|
||||
is_confirmed: true,
|
||||
password_reset_pending: true,
|
||||
is_approved: false,
|
||||
is_approved: true,
|
||||
registration_reason: "ahhhhh",
|
||||
confirmation_token: "qqqq",
|
||||
domain_blocks: ["lain.com"],
|
||||
|
|
@ -1668,8 +1668,8 @@ defmodule Pleroma.UserTest do
|
|||
email: nil,
|
||||
name: nil,
|
||||
password_hash: nil,
|
||||
keys: nil,
|
||||
public_key: nil,
|
||||
keys: "RSA begin buplic key",
|
||||
public_key: "--PRIVATE KEYE--",
|
||||
avatar: %{},
|
||||
tags: [],
|
||||
last_refreshed_at: nil,
|
||||
|
|
@ -1700,6 +1700,24 @@ defmodule Pleroma.UserTest do
|
|||
} = user
|
||||
end
|
||||
|
||||
test "delete/1 purges a remote user" do
|
||||
user =
|
||||
insert(:user, %{
|
||||
name: "qqqqqqq",
|
||||
avatar: %{"a" => "b"},
|
||||
banner: %{"a" => "b"},
|
||||
local: false
|
||||
})
|
||||
|
||||
{:ok, job} = User.delete(user)
|
||||
{:ok, _} = ObanHelpers.perform(job)
|
||||
user = User.get_by_id(user.id)
|
||||
|
||||
assert user.name == nil
|
||||
assert user.avatar == %{}
|
||||
assert user.banner == %{}
|
||||
end
|
||||
|
||||
test "get_public_key_for_ap_id fetches a user that's not in the db" do
|
||||
assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,6 +33,18 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do
|
|||
assert {:ok, _object, _meta} = ObjectValidator.validate(valid_announce, [])
|
||||
end
|
||||
|
||||
test "keeps announced object context", %{valid_announce: valid_announce} do
|
||||
assert %Object{data: %{"context" => object_context}} =
|
||||
Object.get_cached_by_ap_id(valid_announce["object"])
|
||||
|
||||
{:ok, %{"context" => context}, _} =
|
||||
valid_announce
|
||||
|> Map.put("context", "https://example.org/invalid_context_id")
|
||||
|> ObjectValidator.validate([])
|
||||
|
||||
assert context == object_context
|
||||
end
|
||||
|
||||
test "returns an error if the object can't be found", %{valid_announce: valid_announce} do
|
||||
without_object =
|
||||
valid_announce
|
||||
|
|
@ -51,16 +63,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do
|
|||
assert {:object, {"can't find object", []}} in cng.errors
|
||||
end
|
||||
|
||||
test "returns an error if we don't have the actor", %{valid_announce: valid_announce} do
|
||||
nonexisting_actor =
|
||||
valid_announce
|
||||
|> Map.put("actor", "https://gensokyo.2hu/users/raymoo")
|
||||
|
||||
{:error, cng} = ObjectValidator.validate(nonexisting_actor, [])
|
||||
|
||||
assert {:actor, {"can't find user", []}} in cng.errors
|
||||
end
|
||||
|
||||
test "returns an error if the actor already announced the object", %{
|
||||
valid_announce: valid_announce,
|
||||
announcer: announcer,
|
||||
|
|
|
|||
|
|
@ -40,17 +40,30 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do
|
|||
assert LikeValidator.cast_and_validate(valid_like).valid?
|
||||
end
|
||||
|
||||
test "sets the 'to' field to the object actor if no recipients are given", %{
|
||||
test "Add object actor from 'to' field if it doesn't owns the like", %{valid_like: valid_like} do
|
||||
user = insert(:user)
|
||||
|
||||
object_actor = valid_like["actor"]
|
||||
|
||||
valid_like =
|
||||
valid_like
|
||||
|> Map.put("actor", user.ap_id)
|
||||
|> Map.put("to", [])
|
||||
|
||||
{:ok, object, _meta} = ObjectValidator.validate(valid_like, [])
|
||||
assert object_actor in object["to"]
|
||||
end
|
||||
|
||||
test "Removes object actor from 'to' field if it owns the like", %{
|
||||
valid_like: valid_like,
|
||||
user: user
|
||||
} do
|
||||
without_recipients =
|
||||
valid_like =
|
||||
valid_like
|
||||
|> Map.delete("to")
|
||||
|> Map.put("to", [user.ap_id])
|
||||
|
||||
{:ok, object, _meta} = ObjectValidator.validate(without_recipients, [])
|
||||
|
||||
assert object["to"] == [user.ap_id]
|
||||
{:ok, object, _meta} = ObjectValidator.validate(valid_like, [])
|
||||
refute user.ap_id in object["to"]
|
||||
end
|
||||
|
||||
test "sets the context field to the context of the object if no context is given", %{
|
||||
|
|
@ -66,16 +79,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do
|
|||
assert object["context"] == post_activity.data["context"]
|
||||
end
|
||||
|
||||
test "it errors when the actor is missing or not known", %{valid_like: valid_like} do
|
||||
without_actor = Map.delete(valid_like, "actor")
|
||||
|
||||
refute LikeValidator.cast_and_validate(without_actor).valid?
|
||||
|
||||
with_invalid_actor = Map.put(valid_like, "actor", "invalidactor")
|
||||
|
||||
refute LikeValidator.cast_and_validate(with_invalid_actor).valid?
|
||||
end
|
||||
|
||||
test "it errors when the object is missing or not known", %{valid_like: valid_like} do
|
||||
without_object = Map.delete(valid_like, "object")
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
|
|||
assert {:ok, %Activity{} = activity} = Relay.publish(note)
|
||||
assert activity.data["type"] == "Announce"
|
||||
assert activity.data["actor"] == service_actor.ap_id
|
||||
assert activity.data["to"] == [service_actor.follower_address]
|
||||
assert service_actor.follower_address in activity.data["to"]
|
||||
assert called(Pleroma.Web.Federator.publish(activity))
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -150,27 +150,4 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do
|
|||
|
||||
assert {:error, _e} = Transmogrifier.handle_incoming(data)
|
||||
end
|
||||
|
||||
test "it does not clobber the addressing on announce activities" do
|
||||
user = insert(:user)
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "hey"})
|
||||
|
||||
data =
|
||||
File.read!("test/fixtures/mastodon-announce.json")
|
||||
|> Jason.decode!()
|
||||
|> Map.put("object", Object.normalize(activity, fetch: false).data["id"])
|
||||
|> Map.put("to", ["http://mastodon.example.org/users/admin/followers"])
|
||||
|> Map.put("cc", [])
|
||||
|
||||
_user =
|
||||
insert(:user,
|
||||
local: false,
|
||||
ap_id: data["actor"],
|
||||
follower_address: "http://mastodon.example.org/users/admin/followers"
|
||||
)
|
||||
|
||||
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
|
||||
|
||||
assert data["to"] == ["http://mastodon.example.org/users/admin/followers"]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1427,30 +1427,27 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
|
|||
]
|
||||
}
|
||||
|
||||
res =
|
||||
assert conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/pleroma/admin/config", %{"configs" => [params]})
|
||||
|> json_response_and_validate_schema(200)
|
||||
assert conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/pleroma/admin/config", %{"configs" => [params]})
|
||||
|> json_response_and_validate_schema(200) ==
|
||||
%{
|
||||
"configs" => [
|
||||
%{
|
||||
"db" => [":instance_thumbnail"],
|
||||
"group" => ":pleroma",
|
||||
"key" => ":instance",
|
||||
"value" => params["value"]
|
||||
}
|
||||
],
|
||||
"need_reboot" => false
|
||||
}
|
||||
|
||||
assert res == %{
|
||||
"configs" => [
|
||||
%{
|
||||
"db" => [":instance_thumbnail"],
|
||||
"group" => ":pleroma",
|
||||
"key" => ":instance",
|
||||
"value" => params["value"]
|
||||
}
|
||||
],
|
||||
"need_reboot" => false
|
||||
}
|
||||
|
||||
_res =
|
||||
assert conn
|
||||
|> get("/api/v1/instance")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"}
|
||||
assert conn
|
||||
|> get("/api/v1/instance")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|> Map.take(["thumbnail"]) ==
|
||||
%{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"}
|
||||
end
|
||||
|
||||
test "Concurrent Limiter", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -5,38 +5,38 @@
|
|||
defmodule Pleroma.Web.Auth.AuthenticatorTest do
|
||||
use Pleroma.Web.ConnCase, async: true
|
||||
|
||||
alias Pleroma.Web.Auth.Authenticator
|
||||
alias Pleroma.Web.Auth.Helpers
|
||||
import Pleroma.Factory
|
||||
|
||||
describe "fetch_user/1" do
|
||||
test "returns user by name" do
|
||||
user = insert(:user)
|
||||
assert Authenticator.fetch_user(user.nickname) == user
|
||||
assert Helpers.fetch_user(user.nickname) == user
|
||||
end
|
||||
|
||||
test "returns user by email" do
|
||||
user = insert(:user)
|
||||
assert Authenticator.fetch_user(user.email) == user
|
||||
assert Helpers.fetch_user(user.email) == user
|
||||
end
|
||||
|
||||
test "returns nil" do
|
||||
assert Authenticator.fetch_user("email") == nil
|
||||
assert Helpers.fetch_user("email") == nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "fetch_credentials/1" do
|
||||
test "returns name and password from authorization params" do
|
||||
params = %{"authorization" => %{"name" => "test", "password" => "test-pass"}}
|
||||
assert Authenticator.fetch_credentials(params) == {:ok, {"test", "test-pass"}}
|
||||
assert Helpers.fetch_credentials(params) == {:ok, {"test", "test-pass"}}
|
||||
end
|
||||
|
||||
test "returns name and password with grant_type 'password'" do
|
||||
params = %{"grant_type" => "password", "username" => "test", "password" => "test-pass"}
|
||||
assert Authenticator.fetch_credentials(params) == {:ok, {"test", "test-pass"}}
|
||||
assert Helpers.fetch_credentials(params) == {:ok, {"test", "test-pass"}}
|
||||
end
|
||||
|
||||
test "returns error" do
|
||||
assert Authenticator.fetch_credentials(%{}) == {:error, :invalid_credentials}
|
||||
assert Helpers.fetch_credentials(%{}) == {:error, :invalid_credentials}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
import ExUnit.CaptureLog
|
||||
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||
|
|
@ -67,6 +69,59 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
|||
object = Object.get_by_id(media["id"])
|
||||
assert object.data["actor"] == user.ap_id
|
||||
end
|
||||
|
||||
test "/api/v2/media, upload_limit", %{conn: conn, user: user} do
|
||||
desc = "Description of the binary"
|
||||
|
||||
upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8
|
||||
|
||||
assert :ok ==
|
||||
File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>)
|
||||
|
||||
large_binary = %Plug.Upload{
|
||||
content_type: nil,
|
||||
path: Path.absname("test/tmp/large_binary.data"),
|
||||
filename: "large_binary.data"
|
||||
}
|
||||
|
||||
assert capture_log(fn ->
|
||||
assert %{"error" => "file_too_large"} =
|
||||
conn
|
||||
|> put_req_header("content-type", "multipart/form-data")
|
||||
|> post("/api/v2/media", %{
|
||||
"file" => large_binary,
|
||||
"description" => desc
|
||||
})
|
||||
|> json_response_and_validate_schema(400)
|
||||
end) =~
|
||||
"[error] Elixir.Pleroma.Upload store (using Pleroma.Uploaders.Local) failed: :file_too_large"
|
||||
|
||||
clear_config([:instance, :upload_limit], upload_limit)
|
||||
|
||||
assert response =
|
||||
conn
|
||||
|> put_req_header("content-type", "multipart/form-data")
|
||||
|> post("/api/v2/media", %{
|
||||
"file" => large_binary,
|
||||
"description" => desc
|
||||
})
|
||||
|> json_response_and_validate_schema(202)
|
||||
|
||||
assert media_id = response["id"]
|
||||
|
||||
%{conn: conn} = oauth_access(["read:media"], user: user)
|
||||
|
||||
media =
|
||||
conn
|
||||
|> get("/api/v1/media/#{media_id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert media["type"] == "unknown"
|
||||
assert media["description"] == desc
|
||||
assert media["id"]
|
||||
|
||||
assert :ok == File.rm(Path.absname("test/tmp/large_binary.data"))
|
||||
end
|
||||
end
|
||||
|
||||
describe "Update media description" do
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
|
|||
"attachment" => [
|
||||
%{
|
||||
"url" => [
|
||||
%{"mediaType" => "image/png", "href" => "https://pleroma.gov/tenshi.png"}
|
||||
%{
|
||||
"mediaType" => "image/png",
|
||||
"href" => "https://pleroma.gov/tenshi.png",
|
||||
"height" => 1024,
|
||||
"width" => 1280
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
|
|
@ -35,7 +40,12 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
|
|||
},
|
||||
%{
|
||||
"url" => [
|
||||
%{"mediaType" => "video/webm", "href" => "https://pleroma.gov/about/juche.webm"}
|
||||
%{
|
||||
"mediaType" => "video/webm",
|
||||
"href" => "https://pleroma.gov/about/juche.webm",
|
||||
"height" => 600,
|
||||
"width" => 800
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
|
|
@ -55,11 +65,15 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
|
|||
assert Enum.all?(
|
||||
[
|
||||
{:meta, [property: "og:image", content: "https://pleroma.gov/tenshi.png"], []},
|
||||
{:meta, [property: "og:image:width", content: "1280"], []},
|
||||
{:meta, [property: "og:image:height", content: "1024"], []},
|
||||
{:meta,
|
||||
[property: "og:audio", content: "http://www.gnu.org/music/free-software-song.au"],
|
||||
[]},
|
||||
{:meta, [property: "og:video", content: "https://pleroma.gov/about/juche.webm"],
|
||||
[]}
|
||||
[]},
|
||||
{:meta, [property: "og:video:width", content: "800"], []},
|
||||
{:meta, [property: "og:video:height", content: "600"], []}
|
||||
],
|
||||
fn element -> element in result end
|
||||
)
|
||||
|
|
@ -93,4 +107,84 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do
|
|||
|
||||
refute {:meta, [property: "og:image", content: "https://misskey.microsoft/corndog.png"], []} in result
|
||||
end
|
||||
|
||||
test "video attachments have image thumbnail with WxH metadata with Preview Proxy enabled" do
|
||||
clear_config([:media_proxy, :enabled], true)
|
||||
clear_config([:media_preview_proxy, :enabled], true)
|
||||
user = insert(:user)
|
||||
|
||||
note =
|
||||
insert(:note, %{
|
||||
data: %{
|
||||
"actor" => user.ap_id,
|
||||
"id" => "https://pleroma.gov/objects/whatever",
|
||||
"content" => "test video post",
|
||||
"sensitive" => false,
|
||||
"attachment" => [
|
||||
%{
|
||||
"url" => [
|
||||
%{
|
||||
"mediaType" => "video/webm",
|
||||
"href" => "https://pleroma.gov/about/juche.webm",
|
||||
"height" => 600,
|
||||
"width" => 800
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
result = OpenGraph.build_tags(%{object: note, url: note.data["id"], user: user})
|
||||
|
||||
assert {:meta, [property: "og:image:width", content: "800"], []} in result
|
||||
assert {:meta, [property: "og:image:height", content: "600"], []} in result
|
||||
|
||||
assert {:meta,
|
||||
[
|
||||
property: "og:image",
|
||||
content:
|
||||
"http://localhost:4001/proxy/preview/LzAnlke-l5oZbNzWsrHfprX1rGw/aHR0cHM6Ly9wbGVyb21hLmdvdi9hYm91dC9qdWNoZS53ZWJt/juche.webm"
|
||||
], []} in result
|
||||
end
|
||||
|
||||
test "video attachments have no image thumbnail with Preview Proxy disabled" do
|
||||
clear_config([:media_proxy, :enabled], true)
|
||||
clear_config([:media_preview_proxy, :enabled], false)
|
||||
user = insert(:user)
|
||||
|
||||
note =
|
||||
insert(:note, %{
|
||||
data: %{
|
||||
"actor" => user.ap_id,
|
||||
"id" => "https://pleroma.gov/objects/whatever",
|
||||
"content" => "test video post",
|
||||
"sensitive" => false,
|
||||
"attachment" => [
|
||||
%{
|
||||
"url" => [
|
||||
%{
|
||||
"mediaType" => "video/webm",
|
||||
"href" => "https://pleroma.gov/about/juche.webm",
|
||||
"height" => 600,
|
||||
"width" => 800
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
result = OpenGraph.build_tags(%{object: note, url: note.data["id"], user: user})
|
||||
|
||||
refute {:meta, [property: "og:image:width", content: "800"], []} in result
|
||||
refute {:meta, [property: "og:image:height", content: "600"], []} in result
|
||||
|
||||
refute {:meta,
|
||||
[
|
||||
property: "og:image",
|
||||
content:
|
||||
"http://localhost:4001/proxy/preview/LzAnlke-l5oZbNzWsrHfprX1rGw/aHR0cHM6Ly9wbGVyb21hLmdvdi9hYm91dC9qdWNoZS53ZWJt/juche.webm"
|
||||
], []} in result
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
alias Pleroma.Web.Endpoint
|
||||
alias Pleroma.Web.MediaProxy
|
||||
alias Pleroma.Web.Metadata.Providers.TwitterCard
|
||||
alias Pleroma.Web.Metadata.Utils
|
||||
alias Pleroma.Web.Router
|
||||
|
|
@ -17,7 +18,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
|
||||
test "it renders twitter card for user info" do
|
||||
user = insert(:user, name: "Jimmy Hendriks", bio: "born 19 March 1994")
|
||||
avatar_url = Utils.attachment_url(User.avatar_url(user))
|
||||
avatar_url = MediaProxy.preview_url(User.avatar_url(user))
|
||||
res = TwitterCard.build_tags(%{user: user})
|
||||
|
||||
assert res == [
|
||||
|
|
@ -46,7 +47,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
|
||||
assert [
|
||||
{:meta, [property: "twitter:title", content: Utils.user_name_string(user)], []},
|
||||
{:meta, [property: "twitter:description", content: "“pleroma in a nutshell”"], []},
|
||||
{:meta, [property: "twitter:description", content: "pleroma in a nutshell"], []},
|
||||
{:meta, [property: "twitter:image", content: "http://localhost:4001/images/avi.png"],
|
||||
[]},
|
||||
{:meta, [property: "twitter:card", content: "summary"], []}
|
||||
|
|
@ -91,7 +92,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
|
||||
assert [
|
||||
{:meta, [property: "twitter:title", content: Utils.user_name_string(user)], []},
|
||||
{:meta, [property: "twitter:description", content: "“pleroma in a nutshell”"], []},
|
||||
{:meta, [property: "twitter:description", content: "pleroma in a nutshell"], []},
|
||||
{:meta, [property: "twitter:image", content: "http://localhost:4001/images/avi.png"],
|
||||
[]},
|
||||
{:meta, [property: "twitter:card", content: "summary"], []}
|
||||
|
|
@ -111,7 +112,14 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
"content" => "pleroma in a nutshell",
|
||||
"attachment" => [
|
||||
%{
|
||||
"url" => [%{"mediaType" => "image/png", "href" => "https://pleroma.gov/tenshi.png"}]
|
||||
"url" => [
|
||||
%{
|
||||
"mediaType" => "image/png",
|
||||
"href" => "https://pleroma.gov/tenshi.png",
|
||||
"height" => 1024,
|
||||
"width" => 1280
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
"url" => [
|
||||
|
|
@ -123,7 +131,12 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
},
|
||||
%{
|
||||
"url" => [
|
||||
%{"mediaType" => "video/webm", "href" => "https://pleroma.gov/about/juche.webm"}
|
||||
%{
|
||||
"mediaType" => "video/webm",
|
||||
"href" => "https://pleroma.gov/about/juche.webm",
|
||||
"height" => 600,
|
||||
"width" => 800
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -134,17 +147,25 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do
|
|||
|
||||
assert [
|
||||
{:meta, [property: "twitter:title", content: Utils.user_name_string(user)], []},
|
||||
{:meta, [property: "twitter:description", content: "“pleroma in a nutshell”"], []},
|
||||
{:meta, [property: "twitter:description", content: "pleroma in a nutshell"], []},
|
||||
{:meta, [property: "twitter:card", content: "summary_large_image"], []},
|
||||
{:meta, [property: "twitter:player", content: "https://pleroma.gov/tenshi.png"], []},
|
||||
{:meta, [property: "twitter:player:width", content: "1280"], []},
|
||||
{:meta, [property: "twitter:player:height", content: "1024"], []},
|
||||
{:meta, [property: "twitter:card", content: "player"], []},
|
||||
{:meta,
|
||||
[
|
||||
property: "twitter:player",
|
||||
content: Router.Helpers.o_status_url(Endpoint, :notice_player, activity.id)
|
||||
], []},
|
||||
{:meta, [property: "twitter:player:width", content: "480"], []},
|
||||
{:meta, [property: "twitter:player:height", content: "480"], []}
|
||||
{:meta, [property: "twitter:player:width", content: "800"], []},
|
||||
{:meta, [property: "twitter:player:height", content: "600"], []},
|
||||
{:meta,
|
||||
[
|
||||
property: "twitter:player:stream",
|
||||
content: "https://pleroma.gov/about/juche.webm"
|
||||
], []},
|
||||
{:meta, [property: "twitter:player:stream:content_type", content: "video/webm"], []}
|
||||
] == result
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ defmodule Pleroma.Web.ShoutChannelTest do
|
|||
|
||||
{:ok, _, socket} =
|
||||
socket(UserSocket, "", %{user_name: user.nickname})
|
||||
|> subscribe_and_join(ShoutChannel, "shout:public")
|
||||
|> subscribe_and_join(ShoutChannel, "chat:public")
|
||||
|
||||
{:ok, socket: socket}
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue