summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mix/pleroma_test.exs2
-rw-r--r--test/mix/tasks/pleroma/config_test.exs3
-rw-r--r--test/mix/tasks/pleroma/ecto/rollback_test.exs2
-rw-r--r--test/mix/tasks/pleroma/robots_txt_test.exs2
-rw-r--r--test/pleroma/config/deprecation_warnings_test.exs6
-rw-r--r--test/pleroma/config_db_test.exs4
-rw-r--r--test/pleroma/conversation/participation_test.exs2
-rw-r--r--test/pleroma/emoji/loader_test.exs2
-rw-r--r--test/pleroma/formatter_test.exs4
-rw-r--r--test/pleroma/healthcheck_test.exs2
-rw-r--r--test/pleroma/http/adapter_helper/gun_test.exs4
-rw-r--r--test/pleroma/otp_version_test.exs2
-rw-r--r--test/pleroma/reverse_proxy_test.exs2
-rw-r--r--test/pleroma/user_test.exs18
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/publisher_test.exs26
-rw-r--r--test/pleroma/web/activity_pub/side_effects_test.exs89
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs2
-rw-r--r--test/pleroma/web/activity_pub/utils_test.exs6
-rw-r--r--test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs2
-rw-r--r--test/pleroma/web/common_api_test.exs57
-rw-r--r--test/pleroma/web/mastodon_api/controllers/account_controller_test.exs6
-rw-r--r--test/pleroma/web/mastodon_api/update_credentials_test.exs16
-rw-r--r--test/pleroma/web/o_auth/mfa_controller_test.exs2
-rw-r--r--test/pleroma/web/o_auth/token/utils_test.exs4
-rw-r--r--test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs2
-rw-r--r--test/pleroma/web/web_finger/web_finger_controller_test.exs2
-rw-r--r--test/support/http_request_mock.ex4
31 files changed, 219 insertions, 62 deletions
diff --git a/test/mix/pleroma_test.exs b/test/mix/pleroma_test.exs
index c981ee9b9..e362223b2 100644
--- a/test/mix/pleroma_test.exs
+++ b/test/mix/pleroma_test.exs
@@ -39,7 +39,7 @@ defmodule Mix.PleromaTest do
describe "get_option/3" do
test "get from options" do
- assert get_option([domain: "some-domain.com"], :domain, "Promt") == "some-domain.com"
+ assert get_option([domain: "some-domain.com"], :domain, "Prompt") == "some-domain.com"
end
test "get from prompt" do
diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs
index cf6d74907..cec1a79e4 100644
--- a/test/mix/tasks/pleroma/config_test.exs
+++ b/test/mix/tasks/pleroma/config_test.exs
@@ -140,7 +140,6 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
federating: true,
federation_incoming_replies_max_depth: 100,
federation_reachability_timeout_days: 7,
- federation_publisher_modules: [Pleroma.Web.ActivityPub.Publisher],
allow_relay: true,
public: true,
quarantined_instances: [],
@@ -184,7 +183,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
{:ok, file} = File.read(temp_file)
assert file ==
- "import Config\n\nconfig :pleroma, :instance,\n name: \"Pleroma\",\n email: \"example@example.com\",\n notify_email: \"noreply@example.com\",\n description: \"A Pleroma instance, an alternative fediverse server\",\n limit: 5000,\n chat_limit: 5000,\n remote_limit: 100_000,\n upload_limit: 16_000_000,\n avatar_upload_limit: 2_000_000,\n background_upload_limit: 4_000_000,\n banner_upload_limit: 4_000_000,\n poll_limits: %{\n max_expiration: 31_536_000,\n max_option_chars: 200,\n max_options: 20,\n min_expiration: 0\n },\n registrations_open: true,\n federating: true,\n federation_incoming_replies_max_depth: 100,\n federation_reachability_timeout_days: 7,\n federation_publisher_modules: [Pleroma.Web.ActivityPub.Publisher],\n allow_relay: true,\n public: true,\n quarantined_instances: [],\n managed_config: true,\n static_dir: \"instance/static/\",\n allowed_post_formats: [\"text/plain\", \"text/html\", \"text/markdown\", \"text/bbcode\"],\n autofollowed_nicknames: [],\n max_pinned_statuses: 1,\n attachment_links: false,\n max_report_comment_size: 1000,\n safe_dm_mentions: false,\n healthcheck: false,\n remote_post_retention_days: 90,\n skip_thread_containment: true,\n limit_to_local_content: :unauthenticated,\n user_bio_length: 5000,\n user_name_length: 100,\n max_account_fields: 10,\n max_remote_account_fields: 20,\n account_field_name_length: 512,\n account_field_value_length: 2048,\n external_user_synchronization: true,\n extended_nickname_format: true,\n multi_factor_authentication: [\n totp: [digits: 6, period: 30],\n backup_codes: [number: 2, length: 6]\n ]\n"
+ "import Config\n\nconfig :pleroma, :instance,\n name: \"Pleroma\",\n email: \"example@example.com\",\n notify_email: \"noreply@example.com\",\n description: \"A Pleroma instance, an alternative fediverse server\",\n limit: 5000,\n chat_limit: 5000,\n remote_limit: 100_000,\n upload_limit: 16_000_000,\n avatar_upload_limit: 2_000_000,\n background_upload_limit: 4_000_000,\n banner_upload_limit: 4_000_000,\n poll_limits: %{\n max_expiration: 31_536_000,\n max_option_chars: 200,\n max_options: 20,\n min_expiration: 0\n },\n registrations_open: true,\n federating: true,\n federation_incoming_replies_max_depth: 100,\n federation_reachability_timeout_days: 7,\n allow_relay: true,\n public: true,\n quarantined_instances: [],\n managed_config: true,\n static_dir: \"instance/static/\",\n allowed_post_formats: [\"text/plain\", \"text/html\", \"text/markdown\", \"text/bbcode\"],\n autofollowed_nicknames: [],\n max_pinned_statuses: 1,\n attachment_links: false,\n max_report_comment_size: 1000,\n safe_dm_mentions: false,\n healthcheck: false,\n remote_post_retention_days: 90,\n skip_thread_containment: true,\n limit_to_local_content: :unauthenticated,\n user_bio_length: 5000,\n user_name_length: 100,\n max_account_fields: 10,\n max_remote_account_fields: 20,\n account_field_name_length: 512,\n account_field_value_length: 2048,\n external_user_synchronization: true,\n extended_nickname_format: true,\n multi_factor_authentication: [\n totp: [digits: 6, period: 30],\n backup_codes: [number: 2, length: 6]\n ]\n"
end
end
diff --git a/test/mix/tasks/pleroma/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs
index db8641e7f..4036b2da6 100644
--- a/test/mix/tasks/pleroma/ecto/rollback_test.exs
+++ b/test/mix/tasks/pleroma/ecto/rollback_test.exs
@@ -13,7 +13,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.RollbackTest do
assert capture_log(fn ->
Mix.Tasks.Pleroma.Ecto.Rollback.run(["--env", "test"])
- end) =~ "[info] Rollback succesfully"
+ end) =~ "[info] Rollback successfully"
Logger.configure(level: level)
end
diff --git a/test/mix/tasks/pleroma/robots_txt_test.exs b/test/mix/tasks/pleroma/robots_txt_test.exs
index 4426fe526..dd6ca9fc8 100644
--- a/test/mix/tasks/pleroma/robots_txt_test.exs
+++ b/test/mix/tasks/pleroma/robots_txt_test.exs
@@ -26,7 +26,7 @@ defmodule Mix.Tasks.Pleroma.RobotsTxtTest do
assert file == "User-Agent: *\nDisallow: /\n"
end
- test "to existance folder" do
+ test "to existing folder" do
path = "test/fixtures/"
file_path = path <> "robots.txt"
clear_config([:instance, :static_dir], path)
diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs
index f3453ddb0..9a482e46e 100644
--- a/test/pleroma/config/deprecation_warnings_test.exs
+++ b/test/pleroma/config/deprecation_warnings_test.exs
@@ -215,7 +215,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
```
config :pleroma, :mrf,
- transparency_exclusions: [{"instance.tld", "Reason to exlude transparency"}]
+ transparency_exclusions: [{"instance.tld", "Reason to exclude transparency"}]
```
"""
end
@@ -327,11 +327,11 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
end) =~ "Your config is using old namespace for activity expiration configuration."
end
- test "check_uploders_s3_public_endpoint/0" do
+ test "check_uploaders_s3_public_endpoint/0" do
clear_config([Pleroma.Uploaders.S3], public_endpoint: "https://fake.amazonaws.com/bucket/")
assert capture_log(fn ->
- DeprecationWarnings.check_uploders_s3_public_endpoint()
+ DeprecationWarnings.check_uploaders_s3_public_endpoint()
end) =~
"Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket."
end
diff --git a/test/pleroma/config_db_test.exs b/test/pleroma/config_db_test.exs
index 97adb9e51..e20da1574 100644
--- a/test/pleroma/config_db_test.exs
+++ b/test/pleroma/config_db_test.exs
@@ -321,7 +321,7 @@ defmodule Pleroma.ConfigDBTest do
}) == {:proxy_url, {:socks5, {127, 0, 0, 1}, 1234}}
end
- test "tuple with n childs" do
+ test "tuple with n children" do
assert ConfigDB.to_elixir_types(%{
"tuple" => [
"v1",
@@ -399,7 +399,7 @@ defmodule Pleroma.ConfigDBTest do
assert ConfigDB.to_elixir_types(a: 1, b: 2, c: "string") == [a: 1, b: 2, c: "string"]
end
- test "complex keyword with nested mixed childs" do
+ test "complex keyword with nested mixed children" do
assert ConfigDB.to_elixir_types([
%{"tuple" => [":uploader", "Pleroma.Uploaders.Local"]},
%{"tuple" => [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs
index a84437677..697bdb7f9 100644
--- a/test/pleroma/conversation/participation_test.exs
+++ b/test/pleroma/conversation/participation_test.exs
@@ -57,7 +57,7 @@ defmodule Pleroma.Conversation.ParticipationTest do
assert Participation.unread_count(other_user) == 0
end
- test "for a new conversation, it sets the recipents of the participation" do
+ test "for a new conversation, it sets the recipients of the participation" do
user = insert(:user)
other_user = insert(:user)
third_user = insert(:user)
diff --git a/test/pleroma/emoji/loader_test.exs b/test/pleroma/emoji/loader_test.exs
index 717424fc8..22ee4e8d1 100644
--- a/test/pleroma/emoji/loader_test.exs
+++ b/test/pleroma/emoji/loader_test.exs
@@ -72,7 +72,7 @@ defmodule Pleroma.Emoji.LoaderTest do
assert group == "special file"
end
- test "no mathing returns nil", %{groups: groups} do
+ test "no matching returns nil", %{groups: groups} do
group =
groups
|> Loader.match_extra("/emoji/some_undefined.png")
diff --git a/test/pleroma/formatter_test.exs b/test/pleroma/formatter_test.exs
index 5e431f6c9..46bb1db67 100644
--- a/test/pleroma/formatter_test.exs
+++ b/test/pleroma/formatter_test.exs
@@ -324,7 +324,7 @@ defmodule Pleroma.FormatterTest do
assert {_text, [], ^expected_tags} = Formatter.linkify(text)
end
- test "parses mulitple tags in html" do
+ test "parses multiple tags in html" do
text = "<p>#tag1 #tag2 #tag3 #tag4</p>"
expected_tags = [
@@ -347,7 +347,7 @@ defmodule Pleroma.FormatterTest do
assert {_text, [], ^expected_tags} = Formatter.linkify(text)
end
- test "parses mulitple tags on mulitple lines in html" do
+ test "parses multiple tags on multiple lines in html" do
text =
"<p>testing...</p><p>#tag1 #tag2 #tag3 #tag4</p><p>paragraph</p><p>#tag5 #tag6 #tag7 #tag8</p>"
diff --git a/test/pleroma/healthcheck_test.exs b/test/pleroma/healthcheck_test.exs
index dc540c9be..733537f02 100644
--- a/test/pleroma/healthcheck_test.exs
+++ b/test/pleroma/healthcheck_test.exs
@@ -25,7 +25,7 @@ defmodule Pleroma.HealthcheckTest do
refute result.healthy
end
- test "chech_health/1" do
+ test "check_health/1" do
result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 9})
assert result.healthy
end
diff --git a/test/pleroma/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs
index 7515f4e79..d567bc844 100644
--- a/test/pleroma/http/adapter_helper/gun_test.exs
+++ b/test/pleroma/http/adapter_helper/gun_test.exs
@@ -36,7 +36,7 @@ defmodule Pleroma.HTTP.AdapterHelper.GunTest do
assert opts[:certificates_verification]
end
- test "https url with non standart port" do
+ test "https url with non-standard port" do
uri = URI.parse("https://example.com:115")
opts = Gun.options([receive_conn: false], uri)
@@ -44,7 +44,7 @@ defmodule Pleroma.HTTP.AdapterHelper.GunTest do
assert opts[:certificates_verification]
end
- test "merges with defaul http adapter config" do
+ test "merges with default http adapter config" do
defaults = Gun.options([receive_conn: false], URI.parse("https://example.com"))
assert Keyword.has_key?(defaults, :a)
assert Keyword.has_key?(defaults, :b)
diff --git a/test/pleroma/otp_version_test.exs b/test/pleroma/otp_version_test.exs
index 642cd1310..21701d5a8 100644
--- a/test/pleroma/otp_version_test.exs
+++ b/test/pleroma/otp_version_test.exs
@@ -28,7 +28,7 @@ defmodule Pleroma.OTPVersionTest do
"23.0"
end
- test "with non existance file" do
+ test "with nonexistent file" do
assert OTPVersion.get_version_from_files([
"test/fixtures/warnings/otp_version/non-exising",
"test/fixtures/warnings/otp_version/22.4"
diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs
index 0bd4db8d1..fb330232a 100644
--- a/test/pleroma/reverse_proxy_test.exs
+++ b/test/pleroma/reverse_proxy_test.exs
@@ -306,7 +306,7 @@ defmodule Pleroma.ReverseProxyTest do
end
describe "response content disposition header" do
- test "not atachment", %{conn: conn} do
+ test "not attachment", %{conn: conn} do
disposition_headers_mock([
{"content-type", "image/gif"},
{"content-length", "0"}
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
index 0da3f820c..726982f1e 100644
--- a/test/pleroma/user_test.exs
+++ b/test/pleroma/user_test.exs
@@ -226,7 +226,7 @@ defmodule Pleroma.UserTest do
assert [] = User.get_follow_requests(followed)
end
- test "follow_all follows mutliple users" do
+ test "follow_all follows multiple users" do
user = insert(:user)
followed_zero = insert(:user)
followed_one = insert(:user)
@@ -250,7 +250,7 @@ defmodule Pleroma.UserTest do
refute User.following?(user, reverse_blocked)
end
- test "follow_all follows mutliple users without duplicating" do
+ test "follow_all follows multiple users without duplicating" do
user = insert(:user)
followed_zero = insert(:user)
followed_one = insert(:user)
@@ -873,7 +873,7 @@ defmodule Pleroma.UserTest do
end
end
- describe "get_or_fetch/1 remote users with tld, while BE is runned on subdomain" do
+ describe "get_or_fetch/1 remote users with tld, while BE is running on a subdomain" do
setup do: clear_config([Pleroma.Web.WebFinger, :update_nickname_on_user_fetch], true)
test "for mastodon" do
@@ -1018,13 +1018,13 @@ defmodule Pleroma.UserTest do
@tag capture_log: true
test "returns nil if no user could be fetched" do
- {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistant@social.heldscal.la")
- assert fetched_user == "not found nonexistant@social.heldscal.la"
+ {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistent@social.heldscal.la")
+ assert fetched_user == "not found nonexistent@social.heldscal.la"
end
- test "returns nil for nonexistant local user" do
- {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistant")
- assert fetched_user == "not found nonexistant"
+ test "returns nil for nonexistent local user" do
+ {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistent")
+ assert fetched_user == "not found nonexistent"
end
test "updates an existing user, if stale" do
@@ -1132,7 +1132,7 @@ defmodule Pleroma.UserTest do
assert cs.valid?
end
- test "it sets the follower_adress" do
+ test "it sets the follower_address" do
cs = User.remote_user_changeset(@valid_remote)
# remote users get a fake local follower address
assert cs.changes.follower_address ==
diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
index a024e8d0f..524294385 100644
--- a/test/pleroma/web/activity_pub/activity_pub_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -1028,7 +1028,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
refute repeat_activity in activities
end
- test "see your own posts even when they adress actors from blocked domains" do
+ test "see your own posts even when they address actors from blocked domains" do
user = insert(:user)
domain = "dogwhistle.zone"
diff --git a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
index 859e6f1e9..5afab0cf9 100644
--- a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
@@ -24,7 +24,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.EnsureRePrependedTest do
assert res["object"]["summary"] == "re: object-summary"
end
- test "it adds `re:` to summary object when child summary containts re-subject of parent summary " do
+ test "it adds `re:` to summary object when child summary contains re-subject of parent summary " do
message = %{
"type" => "Create",
"object" => %{
diff --git a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
index 3b8a2df86..a615c1d9a 100644
--- a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
@@ -164,7 +164,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidatorTest do
assert attachment.mediaType == "image/jpeg"
end
- test "it transforms image dimentions to our internal format" do
+ test "it transforms image dimensions to our internal format" do
attachment = %{
"type" => "Document",
"name" => "Hello world",
diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs
index 9800144b5..bab25c8ab 100644
--- a/test/pleroma/web/activity_pub/publisher_test.exs
+++ b/test/pleroma/web/activity_pub/publisher_test.exs
@@ -268,7 +268,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
describe "publish/2" do
test_with_mock "doesn't publish a non-public activity to quarantined instances.",
- Pleroma.Web.Federator.Publisher,
+ Pleroma.Web.ActivityPub.Publisher,
[:passthrough],
[] do
Config.put([:instance, :quarantined_instances], [{"domain.com", "some reason"}])
@@ -295,7 +295,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert not called(
- Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
+ Publisher.enqueue_one(%{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
@@ -304,7 +304,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
end
test_with_mock "Publishes a non-public activity to non-quarantined instances.",
- Pleroma.Web.Federator.Publisher,
+ Pleroma.Web.ActivityPub.Publisher,
[:passthrough],
[] do
Config.put([:instance, :quarantined_instances], [{"somedomain.com", "some reason"}])
@@ -331,8 +331,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert called(
- Pleroma.Web.Federator.Publisher.enqueue_one(
- Publisher,
+ Publisher.enqueue_one(
%{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
@@ -344,7 +343,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
end
test_with_mock "Publishes to directly addressed actors with higher priority.",
- Pleroma.Web.Federator.Publisher,
+ Pleroma.Web.ActivityPub.Publisher,
[:passthrough],
[] do
note_activity = insert(:direct_note_activity)
@@ -356,8 +355,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert called(
- Pleroma.Web.Federator.Publisher.enqueue_one(
- Publisher,
+ Publisher.enqueue_one(
%{
inbox: :_,
actor_id: actor.id,
@@ -369,7 +367,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
end
test_with_mock "publishes an activity with BCC to all relevant peers.",
- Pleroma.Web.Federator.Publisher,
+ Pleroma.Web.ActivityPub.Publisher,
[:passthrough],
[] do
follower =
@@ -393,7 +391,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert called(
- Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
+ Publisher.enqueue_one(%{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
@@ -402,7 +400,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
end
test_with_mock "publishes a delete activity to peers who signed fetch requests to the create acitvity/object.",
- Pleroma.Web.Federator.Publisher,
+ Pleroma.Web.ActivityPub.Publisher,
[:passthrough],
[] do
fetcher =
@@ -443,8 +441,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert called(
- Pleroma.Web.Federator.Publisher.enqueue_one(
- Publisher,
+ Publisher.enqueue_one(
%{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
@@ -455,8 +452,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
)
assert called(
- Pleroma.Web.Federator.Publisher.enqueue_one(
- Publisher,
+ Publisher.enqueue_one(
%{
inbox: "https://domain2.com/users/nick1/inbox",
actor_id: actor.id,
diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs
index 6820e23d0..94cc80b76 100644
--- a/test/pleroma/web/activity_pub/side_effects_test.exs
+++ b/test/pleroma/web/activity_pub/side_effects_test.exs
@@ -17,11 +17,19 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.SideEffects
+ alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.CommonAPI.ActivityDraft
import Mock
import Pleroma.Factory
+ defp get_announces_of_object(%{data: %{"id" => id}} = _object) do
+ Pleroma.Activity.Queries.by_type("Announce")
+ |> Pleroma.Activity.Queries.by_object_id(id)
+ |> Pleroma.Repo.all()
+ end
+
describe "handle_after_transaction" do
test "it streams out notifications and streams" do
author = insert(:user, local: true)
@@ -915,4 +923,85 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
assert User.get_follow_state(user, followed, nil) == nil
end
end
+
+ describe "Group actors" do
+ setup do
+ poster =
+ insert(:user,
+ local: false,
+ nickname: "poster@example.com",
+ ap_id: "https://example.com/users/poster"
+ )
+
+ group = insert(:user, actor_type: "Group")
+
+ make_create = fn mentioned_users ->
+ mentions = mentioned_users |> Enum.map(fn u -> "@#{u.nickname}" end) |> Enum.join(" ")
+ {:ok, draft} = ActivityDraft.create(poster, %{status: "#{mentions} hey"})
+
+ create_activity_data =
+ Utils.make_create_data(draft.changes |> Map.put(:published, nil), %{})
+ |> put_in(["object", "id"], "https://example.com/object")
+ |> put_in(["id"], "https://example.com/activity")
+
+ assert Enum.all?(mentioned_users, fn u -> u.ap_id in create_activity_data["to"] end)
+
+ create_activity_data
+ end
+
+ %{poster: poster, group: group, make_create: make_create}
+ end
+
+ test "group should boost it", %{make_create: make_create, group: group} do
+ create_activity_data = make_create.([group])
+ {:ok, create_activity, _meta} = ActivityPub.persist(create_activity_data, local: false)
+
+ {:ok, _create_activity, _meta} =
+ SideEffects.handle(create_activity,
+ local: false,
+ object_data: create_activity_data["object"]
+ )
+
+ object = Object.normalize(create_activity, fetch: false)
+ assert [announce] = get_announces_of_object(object)
+ assert announce.actor == group.ap_id
+ end
+
+ test "remote group should not boost it", %{make_create: make_create, group: group} do
+ remote_group =
+ insert(:user, actor_type: "Group", local: false, nickname: "remotegroup@example.com")
+
+ create_activity_data = make_create.([group, remote_group])
+ {:ok, create_activity, _meta} = ActivityPub.persist(create_activity_data, local: false)
+
+ {:ok, _create_activity, _meta} =
+ SideEffects.handle(create_activity,
+ local: false,
+ object_data: create_activity_data["object"]
+ )
+
+ object = Object.normalize(create_activity, fetch: false)
+ assert [announce] = get_announces_of_object(object)
+ assert announce.actor == group.ap_id
+ end
+
+ test "group should not boost it if group is blocking poster", %{
+ make_create: make_create,
+ group: group,
+ poster: poster
+ } do
+ {:ok, _} = CommonAPI.block(group, poster)
+ create_activity_data = make_create.([group])
+ {:ok, create_activity, _meta} = ActivityPub.persist(create_activity_data, local: false)
+
+ {:ok, _create_activity, _meta} =
+ SideEffects.handle(create_activity,
+ local: false,
+ object_data: create_activity_data["object"]
+ )
+
+ object = Object.normalize(create_activity, fetch: false)
+ assert [] = get_announces_of_object(object)
+ end
+ end
end
diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
index a9ad3e9c8..9750fa25f 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
@@ -508,7 +508,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
[data: data]
end
- test "returns not modified object when hasn't containts inReplyTo field", %{data: data} do
+ test "returns not modified object when has no inReplyTo field", %{data: data} do
assert Transmogrifier.fix_in_reply_to(data) == data
end
diff --git a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
index 846d25cbe..ea01c92fa 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
@@ -32,7 +32,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UndoHandlingTest do
assert activity.data["type"] == "Undo"
end
- test "it returns an error for incoming unlikes wihout a like activity" do
+ test "it returns an error for incoming unlikes without a like activity" do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "leave a like pls"})
diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs
index 9ca21f5d9..cd61e3e4b 100644
--- a/test/pleroma/web/activity_pub/utils_test.exs
+++ b/test/pleroma/web/activity_pub/utils_test.exs
@@ -17,7 +17,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
require Pleroma.Constants
describe "strip_report_status_data/1" do
- test "does not break on issues with the reported activites" do
+ test "does not break on issues with the reported activities" do
reporter = insert(:user)
target_account = insert(:user)
{:ok, activity} = CommonAPI.post(target_account, %{status: "foobar"})
@@ -153,7 +153,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
assert Enum.sort(cc) == expected_cc
end
- test "does not adress actor's follower address if the activity is not public", %{
+ test "does not address actor's follower address if the activity is not public", %{
user: user,
other_user: other_user,
third_user: third_user
@@ -622,7 +622,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
end
describe "get_cached_emoji_reactions/1" do
- test "returns the normalized data or an emtpy list" do
+ test "returns the normalized data or an empty list" do
object = insert(:note)
assert Utils.get_cached_emoji_reactions(object) == []
diff --git a/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs
index 80646dd25..10eefbeca 100644
--- a/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs
@@ -163,7 +163,7 @@ defmodule Pleroma.Web.AdminAPI.OAuthAppControllerTest do
assert response == ""
end
- test "with non existance id", %{conn: conn} do
+ test "with nonexistent id", %{conn: conn} do
response =
conn
|> delete("/api/pleroma/admin/oauth_app/0")
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
index 98b922b52..f002172c5 100644
--- a/test/pleroma/web/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -26,8 +26,15 @@ defmodule Pleroma.Web.CommonAPITest do
import Mox
import Pleroma.Factory
+ require Pleroma.Activity.Queries
require Pleroma.Constants
+ defp get_announces_of_object(%{data: %{"id" => id}} = _object) do
+ Pleroma.Activity.Queries.by_type("Announce")
+ |> Pleroma.Activity.Queries.by_object_id(id)
+ |> Pleroma.Repo.all()
+ end
+
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
@@ -1835,4 +1842,54 @@ defmodule Pleroma.Web.CommonAPITest do
assert Map.has_key?(updated_object.data, "updated")
end
end
+
+ describe "Group actors" do
+ setup do
+ poster = insert(:user)
+ group = insert(:user, actor_type: "Group")
+ other_group = insert(:user, actor_type: "Group")
+ %{poster: poster, group: group, other_group: other_group}
+ end
+
+ test "it boosts public posts", %{poster: poster, group: group} do
+ {:ok, post} = CommonAPI.post(poster, %{status: "hey @#{group.nickname}"})
+
+ announces = get_announces_of_object(post.object)
+ assert [_] = announces
+ end
+
+ test "it does not boost private posts", %{poster: poster, group: group} do
+ {:ok, private_post} =
+ CommonAPI.post(poster, %{status: "hey @#{group.nickname}", visibility: "private"})
+
+ assert [] = get_announces_of_object(private_post.object)
+ end
+
+ test "remote groups do not boost any posts", %{poster: poster} do
+ remote_group =
+ insert(:user, actor_type: "Group", local: false, nickname: "remote@example.com")
+
+ {:ok, post} = CommonAPI.post(poster, %{status: "hey @#{User.full_nickname(remote_group)}"})
+ assert remote_group.ap_id in post.data["to"]
+
+ announces = get_announces_of_object(post.object)
+ assert [] = announces
+ end
+
+ test "multiple groups mentioned", %{poster: poster, group: group, other_group: other_group} do
+ {:ok, post} =
+ CommonAPI.post(poster, %{status: "hey @#{group.nickname} @#{other_group.nickname}"})
+
+ announces = get_announces_of_object(post.object)
+ assert [_, _] = announces
+ end
+
+ test "it does not boost if group is blocking poster", %{poster: poster, group: group} do
+ {:ok, _} = CommonAPI.block(group, poster)
+ {:ok, post} = CommonAPI.post(poster, %{status: "hey @#{group.nickname}"})
+
+ announces = get_announces_of_object(post.object)
+ assert [] = announces
+ end
+ end
end
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index d8e5f9d39..aa7726a9c 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -1360,7 +1360,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
assert user.registration_reason == "I'm a cool dude, bro"
end
- test "returns error when user already registred", %{conn: conn, valid_params: valid_params} do
+ test "returns error when user already registered", %{conn: conn, valid_params: valid_params} do
_user = insert(:user, email: "lain@example.org")
app_token = insert(:oauth_token, user: nil)
@@ -1495,7 +1495,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> Plug.Conn.put_req_header("authorization", "Bearer " <> token)
|> put_req_header("content-type", "multipart/form-data")
|> post("/api/v1/accounts", %{
- nickname: "nickanme",
+ nickname: "nickname",
agreement: true,
email: "email@example.com",
fullname: "Lain",
@@ -1781,7 +1781,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
assert %{language: "ru_RU"} = Pleroma.User.get_by_nickname("foo")
end
- test "createing an account without language parameter should fallback to cookie/header language",
+ test "creating an account without language parameter should fallback to cookie/header language",
%{conn: conn} do
params = %{
username: "foo2",
diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs
index fc8b79536..cf26cd9a6 100644
--- a/test/pleroma/web/mastodon_api/update_credentials_test.exs
+++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs
@@ -732,4 +732,20 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
assert account["source"]["pleroma"]["actor_type"] == "Person"
end
end
+
+ describe "Mark account as group" do
+ setup do: oauth_access(["write:accounts"])
+ setup :request_content_type
+
+ test "changing actor_type to Group makes account a Group and enables bot indicator for backward compatibility",
+ %{conn: conn} do
+ account =
+ conn
+ |> patch("/api/v1/accounts/update_credentials", %{actor_type: "Group"})
+ |> json_response_and_validate_schema(200)
+
+ assert account["bot"]
+ assert account["source"]["pleroma"]["actor_type"] == "Group"
+ end
+ end
end
diff --git a/test/pleroma/web/o_auth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs
index 62404c768..ac854e818 100644
--- a/test/pleroma/web/o_auth/mfa_controller_test.exs
+++ b/test/pleroma/web/o_auth/mfa_controller_test.exs
@@ -214,7 +214,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do
assert response == %{"error" => "Invalid code"}
end
- test "returns error when client credentails is wrong ", %{conn: conn, user: user} do
+ test "returns error when client credentials is wrong ", %{conn: conn, user: user} do
otp_token = TOTP.generate_token(user.multi_factor_authentication_settings.totp.secret)
mfa_token = insert(:mfa_token, user: user)
diff --git a/test/pleroma/web/o_auth/token/utils_test.exs b/test/pleroma/web/o_auth/token/utils_test.exs
index e688ad750..f4027985d 100644
--- a/test/pleroma/web/o_auth/token/utils_test.exs
+++ b/test/pleroma/web/o_auth/token/utils_test.exs
@@ -13,7 +13,7 @@ defmodule Pleroma.Web.OAuth.Token.UtilsTest do
Utils.fetch_app(%Plug.Conn{params: %{"client_id" => 1, "client_secret" => "x"}})
end
- test "returns App by params credentails" do
+ test "returns App by params credentials" do
app = insert(:oauth_app)
assert {:ok, load_app} =
@@ -24,7 +24,7 @@ defmodule Pleroma.Web.OAuth.Token.UtilsTest do
assert load_app == app
end
- test "returns App by header credentails" do
+ test "returns App by header credentials" do
app = insert(:oauth_app)
header = "Basic " <> Base.encode64("#{app.client_id}:#{app.client_secret}")
diff --git a/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs
index 02afeda67..0d4951a73 100644
--- a/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs
@@ -16,7 +16,7 @@ defmodule Pleroma.Web.PleromaApi.InstancesControllerTest do
{:ok, %Pleroma.Instances.Instance{unreachable_since: constant_unreachable}} =
Instances.set_consistently_unreachable(constant)
- _eventual_unrechable = Instances.set_unreachable(eventual)
+ _eventual_unreachable = Instances.set_unreachable(eventual)
%{constant_unreachable: constant_unreachable, constant: constant}
end
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 5e3ac26f9..e01cec5e4 100644
--- a/test/pleroma/web/web_finger/web_finger_controller_test.exs
+++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs
@@ -48,7 +48,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
]
end
- test "reach user on tld, while pleroma is runned on subdomain" do
+ test "reach user on tld, while pleroma is running on subdomain" do
Pleroma.Web.Endpoint.config_change(
[{Pleroma.Web.Endpoint, url: [host: "sub.example.com"]}],
[]
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index 11cc2eb94..f76128312 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -178,7 +178,7 @@ defmodule HttpRequestMock do
end
def get(
- "https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la",
+ "https://social.heldscal.la/.well-known/webfinger?resource=nonexistent@social.heldscal.la",
_,
_,
[{"accept", "application/xrd+xml,application/jrd+json"}]
@@ -186,7 +186,7 @@ defmodule HttpRequestMock do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/nonexistant@social.heldscal.la.xml")
+ body: File.read!("test/fixtures/tesla_mock/nonexistent@social.heldscal.la.xml")
}}
end