forked from AkkomaGang/akkoma
CI: Bump lint stage to elixir-1.12
Elixir 1.12 changed formatting rules, this allows to avoid having to rollback to run `mix format`
This commit is contained in:
parent
bdaa7e5394
commit
a17910a6c6
39 changed files with 60 additions and 201 deletions
|
@ -134,6 +134,7 @@ unit-testing-rum:
|
||||||
- mix test --preload-modules
|
- mix test --preload-modules
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
image: elixir:1.12
|
||||||
stage: test
|
stage: test
|
||||||
only:
|
only:
|
||||||
changes:
|
changes:
|
||||||
|
|
|
@ -286,9 +286,7 @@ defp migrate_from_db(opts) do
|
||||||
file = File.open!(tmp_config_path)
|
file = File.open!(tmp_config_path)
|
||||||
|
|
||||||
shell_info(
|
shell_info(
|
||||||
"Saving database configuration settings to #{tmp_config_path}. Copy it to the #{
|
"Saving database configuration settings to #{tmp_config_path}. Copy it to the #{Path.dirname(config_path)} manually."
|
||||||
Path.dirname(config_path)
|
|
||||||
} manually."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
write_config(file, tmp_config_path, opts)
|
write_config(file, tmp_config_path, opts)
|
||||||
|
|
|
@ -51,9 +51,7 @@ def run(["new", nickname, email | rest]) do
|
||||||
A user will be created with the following information:
|
A user will be created with the following information:
|
||||||
- nickname: #{nickname}
|
- nickname: #{nickname}
|
||||||
- email: #{email}
|
- email: #{email}
|
||||||
- password: #{
|
- password: #{if(generated_password?, do: "[generated; a reset link will be created]", else: password)}
|
||||||
if(generated_password?, do: "[generated; a reset link will be created]", else: password)
|
|
||||||
}
|
|
||||||
- name: #{name}
|
- name: #{name}
|
||||||
- bio: #{bio}
|
- bio: #{bio}
|
||||||
- moderator: #{if(moderator?, do: "true", else: "false")}
|
- moderator: #{if(moderator?, do: "true", else: "false")}
|
||||||
|
@ -114,15 +112,9 @@ def run(["reset_password", nickname]) do
|
||||||
{:ok, token} <- Pleroma.PasswordResetToken.create_token(user) do
|
{:ok, token} <- Pleroma.PasswordResetToken.create_token(user) do
|
||||||
shell_info("Generated password reset token for #{user.nickname}")
|
shell_info("Generated password reset token for #{user.nickname}")
|
||||||
|
|
||||||
IO.puts(
|
IO.puts("URL: #{Pleroma.Web.Router.Helpers.reset_password_url(Pleroma.Web.Endpoint,
|
||||||
"URL: #{
|
:reset,
|
||||||
Pleroma.Web.Router.Helpers.reset_password_url(
|
token.token)}")
|
||||||
Pleroma.Web.Endpoint,
|
|
||||||
:reset,
|
|
||||||
token.token
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
shell_error("No local user #{nickname}")
|
shell_error("No local user #{nickname}")
|
||||||
|
@ -321,9 +313,7 @@ def run(["invites"]) do
|
||||||
end
|
end
|
||||||
|
|
||||||
shell_info(
|
shell_info(
|
||||||
"ID: #{invite.id} | Token: #{invite.token} | Token type: #{invite.invite_type} | Used: #{
|
"ID: #{invite.id} | Token: #{invite.token} | Token type: #{invite.invite_type} | Used: #{invite.used}#{expire_info}#{using_info}"
|
||||||
invite.used
|
|
||||||
}#{expire_info}#{using_info}"
|
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -424,9 +414,7 @@ def run(["list"]) do
|
||||||
users
|
users
|
||||||
|> Enum.each(fn user ->
|
|> Enum.each(fn user ->
|
||||||
shell_info(
|
shell_info(
|
||||||
"#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{
|
"#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{user.is_locked}, is_active: #{user.is_active}"
|
||||||
user.is_locked
|
|
||||||
}, is_active: #{user.is_active}"
|
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -19,9 +19,7 @@ def on_shell(username, _pubkey, _ip, _port) do
|
||||||
def on_connect(username, ip, port, method) do
|
def on_connect(username, ip, port, method) do
|
||||||
Logger.debug(fn ->
|
Logger.debug(fn ->
|
||||||
"""
|
"""
|
||||||
Incoming SSH shell #{inspect(self())} requested for #{username} from #{inspect(ip)}:#{
|
Incoming SSH shell #{inspect(self())} requested for #{username} from #{inspect(ip)}:#{inspect(port)} using #{inspect(method)}
|
||||||
inspect(port)
|
|
||||||
} using #{inspect(method)}
|
|
||||||
"""
|
"""
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,9 +21,7 @@ def warn do
|
||||||
"""
|
"""
|
||||||
!!!OBAN CONFIG WARNING!!!
|
!!!OBAN CONFIG WARNING!!!
|
||||||
You are using old workers in Oban crontab settings, which were removed.
|
You are using old workers in Oban crontab settings, which were removed.
|
||||||
Please, remove setting from crontab in your config file (prod.secret.exs): #{
|
Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)}
|
||||||
inspect(setting)
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
|> Logger.warn()
|
|> Logger.warn()
|
||||||
|
|
||||||
|
|
|
@ -148,9 +148,7 @@ defp update({group, key, value, merged}) do
|
||||||
rescue
|
rescue
|
||||||
error ->
|
error ->
|
||||||
error_msg =
|
error_msg =
|
||||||
"updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{
|
"updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}"
|
||||||
inspect(value)
|
|
||||||
} error: #{inspect(error)}"
|
|
||||||
|
|
||||||
Logger.warn(error_msg)
|
Logger.warn(error_msg)
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,7 @@ def load do
|
||||||
|
|
||||||
if not Enum.empty?(files) do
|
if not Enum.empty?(files) do
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
"Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{
|
"Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}"
|
||||||
Enum.join(files, ", ")
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,9 +120,7 @@ defp load_pack(pack_dir, emoji_groups) do
|
||||||
extensions = Config.get([:emoji, :pack_extensions])
|
extensions = Config.get([:emoji, :pack_extensions])
|
||||||
|
|
||||||
Logger.info(
|
Logger.info(
|
||||||
"No emoji.txt found for pack \"#{pack_name}\", assuming all #{
|
"No emoji.txt found for pack \"#{pack_name}\", assuming all #{Enum.join(extensions, ", ")} files are emoji"
|
||||||
Enum.join(extensions, ", ")
|
|
||||||
} files are emoji"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
make_shortcode_to_file_map(pack_dir, extensions)
|
make_shortcode_to_file_map(pack_dir, extensions)
|
||||||
|
|
|
@ -57,9 +57,7 @@ defp do_open(uri, %{proxy: {proxy_host, proxy_port}} = opts) do
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
"Opening proxied connection to #{compose_uri_log(uri)} failed with error #{
|
"Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
|
||||||
inspect(error)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
error
|
error
|
||||||
|
@ -93,9 +91,7 @@ defp do_open(uri, %{proxy: {proxy_type, proxy_host, proxy_port}} = opts) do
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
"Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{
|
"Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
|
||||||
inspect(error)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
error
|
error
|
||||||
|
|
|
@ -481,9 +481,7 @@ def get_log_entry_message(%ModerationLog{
|
||||||
"visibility" => visibility
|
"visibility" => visibility
|
||||||
}
|
}
|
||||||
}) do
|
}) do
|
||||||
"@#{actor_nickname} updated status ##{subject_id}, set sensitive: '#{sensitive}', visibility: '#{
|
"@#{actor_nickname} updated status ##{subject_id}, set sensitive: '#{sensitive}', visibility: '#{visibility}'"
|
||||||
visibility
|
|
||||||
}'"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_log_entry_message(%ModerationLog{
|
def get_log_entry_message(%ModerationLog{
|
||||||
|
@ -523,9 +521,7 @@ def get_log_entry_message(%ModerationLog{
|
||||||
"subject" => subjects
|
"subject" => subjects
|
||||||
}
|
}
|
||||||
}) do
|
}) do
|
||||||
"@#{actor_nickname} re-sent confirmation email for users: #{
|
"@#{actor_nickname} re-sent confirmation email for users: #{users_to_nicknames_string(subjects)}"
|
||||||
users_to_nicknames_string(subjects)
|
|
||||||
}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_log_entry_message(%ModerationLog{
|
def get_log_entry_message(%ModerationLog{
|
||||||
|
|
|
@ -29,9 +29,7 @@ def handle_event(
|
||||||
_
|
_
|
||||||
) do
|
) do
|
||||||
Logger.debug(fn ->
|
Logger.debug(fn ->
|
||||||
"Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{
|
"Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{reclaim_max} connections"
|
||||||
reclaim_max
|
|
||||||
} connections"
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -73,9 +71,7 @@ def handle_event(
|
||||||
_
|
_
|
||||||
) do
|
) do
|
||||||
Logger.warn(fn ->
|
Logger.warn(fn ->
|
||||||
"Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{
|
"Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{inspect(reason)}"
|
||||||
inspect(reason)
|
|
||||||
}"
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1597,9 +1597,7 @@ def maybe_handle_clashing_nickname(data) do
|
||||||
%User{} = old_user <- User.get_by_nickname(nickname),
|
%User{} = old_user <- User.get_by_nickname(nickname),
|
||||||
{_, false} <- {:ap_id_comparison, data[:ap_id] == old_user.ap_id} do
|
{_, false} <- {:ap_id_comparison, data[:ap_id] == old_user.ap_id} do
|
||||||
Logger.info(
|
Logger.info(
|
||||||
"Found an old user for #{nickname}, the old ap id is #{old_user.ap_id}, new one is #{
|
"Found an old user for #{nickname}, the old ap id is #{old_user.ap_id}, new one is #{data[:ap_id]}, renaming."
|
||||||
data[:ap_id]
|
|
||||||
}, renaming."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
old_user
|
old_user
|
||||||
|
|
|
@ -157,9 +157,7 @@ def config_descriptions(policies) do
|
||||||
[description | acc]
|
[description | acc]
|
||||||
else
|
else
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
"#{policy} config description doesn't have one or all required keys #{
|
"#{policy} config description doesn't have one or all required keys #{inspect(@required_description_keys)}"
|
||||||
inspect(@required_description_keys)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
acc
|
acc
|
||||||
|
|
|
@ -38,9 +38,7 @@ defp steal_emoji({shortcode, url}, emoji_dir_path) do
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
"MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{
|
"MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{size_limit} B)"
|
||||||
size_limit
|
|
||||||
} B)"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -23,9 +23,7 @@ defp lookup_subchain(actor) do
|
||||||
def filter(%{"actor" => actor} = message) do
|
def filter(%{"actor" => actor} = message) do
|
||||||
with {:ok, match, subchain} <- lookup_subchain(actor) do
|
with {:ok, match, subchain} <- lookup_subchain(actor) do
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
"[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{
|
"[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{inspect(subchain)}"
|
||||||
inspect(subchain)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
MRF.filter(subchain, message)
|
MRF.filter(subchain, message)
|
||||||
|
|
|
@ -487,9 +487,7 @@ def remove_mute(user_id, activity_id) do
|
||||||
else
|
else
|
||||||
{what, result} = error ->
|
{what, result} = error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
"CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{
|
"CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{activity_id}"
|
||||||
activity_id
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
{:error, error}
|
{:error, error}
|
||||||
|
|
|
@ -49,9 +49,7 @@ def init(%{qs: qs} = req, state) do
|
||||||
|
|
||||||
def websocket_init(state) do
|
def websocket_init(state) do
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
"#{__MODULE__} accepted websocket connection for user #{
|
"#{__MODULE__} accepted websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic}"
|
||||||
(state.user || %{id: "anonymous"}).id
|
|
||||||
}, topic #{state.topic}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Streamer.add_socket(state.topic, state.user)
|
Streamer.add_socket(state.topic, state.user)
|
||||||
|
@ -106,9 +104,7 @@ def terminate(_reason, _req, []), do: :ok
|
||||||
|
|
||||||
def terminate(reason, _req, state) do
|
def terminate(reason, _req, state) do
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
"#{__MODULE__} terminating websocket connection for user #{
|
"#{__MODULE__} terminating websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic || "?"}: #{inspect(reason)}"
|
||||||
(state.user || %{id: "anonymous"}).id
|
|
||||||
}, topic #{state.topic || "?"}: #{inspect(reason)}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Streamer.remove_socket(state.topic)
|
Streamer.remove_socket(state.topic)
|
||||||
|
|
|
@ -14,9 +14,7 @@ def up do
|
||||||
max = min + 10_000
|
max = min + 10_000
|
||||||
|
|
||||||
execute("""
|
execute("""
|
||||||
update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{
|
update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{min} and id <= #{max};
|
||||||
min
|
|
||||||
} and id <= #{max};
|
|
||||||
""")
|
""")
|
||||||
|> IO.inspect()
|
|> IO.inspect()
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -28,9 +28,7 @@ def change do
|
||||||
{:ok, %{rows: ap_ids}} =
|
{:ok, %{rows: ap_ids}} =
|
||||||
Ecto.Adapters.SQL.query(
|
Ecto.Adapters.SQL.query(
|
||||||
Repo,
|
Repo,
|
||||||
"select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{
|
"select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{instance_uri}/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;",
|
||||||
instance_uri
|
|
||||||
}/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;",
|
|
||||||
[],
|
[],
|
||||||
timeout: :infinity
|
timeout: :infinity
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,11 +27,7 @@ test "build report email" do
|
||||||
assert res.subject == "#{config[:name]} Report"
|
assert res.subject == "#{config[:name]} Report"
|
||||||
|
|
||||||
assert res.html_body ==
|
assert res.html_body ==
|
||||||
"<p>Reported by: <a href=\"#{reporter_url}\">#{reporter.nickname}</a></p>\n<p>Reported Account: <a href=\"#{
|
"<p>Reported by: <a href=\"#{reporter_url}\">#{reporter.nickname}</a></p>\n<p>Reported Account: <a href=\"#{account_url}\">#{account.nickname}</a></p>\n<p>Comment: Test comment\n<p> Statuses:\n <ul>\n <li><a href=\"#{status_url}\">#{status_url}</li>\n </ul>\n</p>\n\n<p>\n<a href=\"http://localhost:4001/pleroma/admin/#/reports/index\">View Reports in AdminFE</a>\n"
|
||||||
account_url
|
|
||||||
}\">#{account.nickname}</a></p>\n<p>Comment: Test comment\n<p> Statuses:\n <ul>\n <li><a href=\"#{
|
|
||||||
status_url
|
|
||||||
}\">#{status_url}</li>\n </ul>\n</p>\n\n<p>\n<a href=\"http://localhost:4001/pleroma/admin/#/reports/index\">View Reports in AdminFE</a>\n"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it works when the reporter is a remote user without email" do
|
test "it works when the reporter is a remote user without email" do
|
||||||
|
|
|
@ -151,13 +151,7 @@ test "gives a replacement for user links, using local nicknames in user links te
|
||||||
assert length(mentions) == 3
|
assert length(mentions) == 3
|
||||||
|
|
||||||
expected_text =
|
expected_text =
|
||||||
~s(<span class="h-card"><a class="u-url mention" data-user="#{gsimg.id}" href="#{
|
~s(<span class="h-card"><a class="u-url mention" data-user="#{gsimg.id}" href="#{gsimg.ap_id}" rel="ugc">@<span>gsimg</span></a></span> According to <span class="h-card"><a class="u-url mention" data-user="#{archaeme.id}" href="#{"https://archeme/@archa_eme_"}" rel="ugc">@<span>archa_eme_</span></a></span>, that is @daggsy. Also hello <span class="h-card"><a class="u-url mention" data-user="#{archaeme_remote.id}" href="#{archaeme_remote.ap_id}" rel="ugc">@<span>archaeme</span></a></span>)
|
||||||
gsimg.ap_id
|
|
||||||
}" rel="ugc">@<span>gsimg</span></a></span> According to <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
archaeme.id
|
|
||||||
}" href="#{"https://archeme/@archa_eme_"}" rel="ugc">@<span>archa_eme_</span></a></span>, that is @daggsy. Also hello <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
archaeme_remote.id
|
|
||||||
}" href="#{archaeme_remote.ap_id}" rel="ugc">@<span>archaeme</span></a></span>)
|
|
||||||
|
|
||||||
assert expected_text == text
|
assert expected_text == text
|
||||||
end
|
end
|
||||||
|
@ -172,9 +166,7 @@ test "gives a replacement for user links when the user is using Osada" do
|
||||||
assert length(mentions) == 1
|
assert length(mentions) == 1
|
||||||
|
|
||||||
expected_text =
|
expected_text =
|
||||||
~s(<span class="h-card"><a class="u-url mention" data-user="#{mike.id}" href="#{
|
~s(<span class="h-card"><a class="u-url mention" data-user="#{mike.id}" href="#{mike.ap_id}" rel="ugc">@<span>mike</span></a></span> test)
|
||||||
mike.ap_id
|
|
||||||
}" rel="ugc">@<span>mike</span></a></span> test)
|
|
||||||
|
|
||||||
assert expected_text == text
|
assert expected_text == text
|
||||||
end
|
end
|
||||||
|
@ -210,13 +202,7 @@ test "given the 'safe_mention' option, it will only mention people in the beginn
|
||||||
assert mentions == [{"@#{user.nickname}", user}, {"@#{other_user.nickname}", other_user}]
|
assert mentions == [{"@#{user.nickname}", user}, {"@#{other_user.nickname}", other_user}]
|
||||||
|
|
||||||
assert expected_text ==
|
assert expected_text ==
|
||||||
~s(<span class="h-card"><a class="u-url mention" data-user="#{user.id}" href="#{
|
~s(<span class="h-card"><a class="u-url mention" data-user="#{user.id}" href="#{user.ap_id}" rel="ugc">@<span>#{user.nickname}</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{other_user.id}" href="#{other_user.ap_id}" rel="ugc">@<span>#{other_user.nickname}</span></a></span> hey dudes i hate <span class="h-card"><a class="u-url mention" data-user="#{third_user.id}" href="#{third_user.ap_id}" rel="ugc">@<span>#{third_user.nickname}</span></a></span>)
|
||||||
user.ap_id
|
|
||||||
}" rel="ugc">@<span>#{user.nickname}</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
other_user.id
|
|
||||||
}" href="#{other_user.ap_id}" rel="ugc">@<span>#{other_user.nickname}</span></a></span> hey dudes i hate <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
third_user.id
|
|
||||||
}" href="#{third_user.ap_id}" rel="ugc">@<span>#{third_user.nickname}</span></a></span>)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "given the 'safe_mention' option, it will still work without any mention" do
|
test "given the 'safe_mention' option, it will still work without any mention" do
|
||||||
|
|
|
@ -236,9 +236,7 @@ test "logging report response", %{moderator: moderator} do
|
||||||
log = Repo.get(ModerationLog, log2.id)
|
log = Repo.get(ModerationLog, log2.id)
|
||||||
|
|
||||||
assert log.data["message"] ==
|
assert log.data["message"] ==
|
||||||
"@#{moderator.nickname} added note 'look at this' to report ##{report.id} on user @#{
|
"@#{moderator.nickname} added note 'look at this' to report ##{report.id} on user @#{user.nickname}"
|
||||||
user.nickname
|
|
||||||
}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "logging status sensitivity update", %{moderator: moderator} do
|
test "logging status sensitivity update", %{moderator: moderator} do
|
||||||
|
|
|
@ -1886,9 +1886,7 @@ test "preserves hosts in user links text" do
|
||||||
bio = "A.k.a. @nick@domain.com"
|
bio = "A.k.a. @nick@domain.com"
|
||||||
|
|
||||||
expected_text =
|
expected_text =
|
||||||
~s(A.k.a. <span class="h-card"><a class="u-url mention" data-user="#{remote_user.id}" href="#{
|
~s(A.k.a. <span class="h-card"><a class="u-url mention" data-user="#{remote_user.id}" href="#{remote_user.ap_id}" rel="ugc">@<span>nick@domain.com</span></a></span>)
|
||||||
remote_user.ap_id
|
|
||||||
}" rel="ugc">@<span>nick@domain.com</span></a></span>)
|
|
||||||
|
|
||||||
assert expected_text == User.parse_bio(bio, user)
|
assert expected_text == User.parse_bio(bio, user)
|
||||||
end
|
end
|
||||||
|
|
|
@ -267,9 +267,7 @@ test "/:right DELETE, can remove from a permission group (multiple)", %{
|
||||||
log_entry = Repo.one(ModerationLog)
|
log_entry = Repo.one(ModerationLog)
|
||||||
|
|
||||||
assert ModerationLog.get_log_entry_message(log_entry) ==
|
assert ModerationLog.get_log_entry_message(log_entry) ==
|
||||||
"@#{admin.nickname} revoked admin role from @#{user_one.nickname}, @#{
|
"@#{admin.nickname} revoked admin role from @#{user_one.nickname}, @#{user_two.nickname}"
|
||||||
user_two.nickname
|
|
||||||
}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -860,9 +858,7 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do
|
||||||
log_entry = Repo.one(ModerationLog)
|
log_entry = Repo.one(ModerationLog)
|
||||||
|
|
||||||
assert ModerationLog.get_log_entry_message(log_entry) ==
|
assert ModerationLog.get_log_entry_message(log_entry) ==
|
||||||
"@#{admin.nickname} confirmed email for users: @#{first_user.nickname}, @#{
|
"@#{admin.nickname} confirmed email for users: @#{first_user.nickname}, @#{second_user.nickname}"
|
||||||
second_user.nickname
|
|
||||||
}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -883,9 +879,7 @@ test "it resend emails for two users", %{conn: conn, admin: admin} do
|
||||||
log_entry = Repo.one(ModerationLog)
|
log_entry = Repo.one(ModerationLog)
|
||||||
|
|
||||||
assert ModerationLog.get_log_entry_message(log_entry) ==
|
assert ModerationLog.get_log_entry_message(log_entry) ==
|
||||||
"@#{admin.nickname} re-sent confirmation email for users: @#{first_user.nickname}, @#{
|
"@#{admin.nickname} re-sent confirmation email for users: @#{first_user.nickname}, @#{second_user.nickname}"
|
||||||
second_user.nickname
|
|
||||||
}"
|
|
||||||
|
|
||||||
ObanHelpers.perform_all()
|
ObanHelpers.perform_all()
|
||||||
|
|
||||||
|
|
|
@ -204,9 +204,7 @@ test "updates state of multiple reports", %{
|
||||||
"@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state"
|
"@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state"
|
||||||
|
|
||||||
assert ModerationLog.get_log_entry_message(second_log_entry) ==
|
assert ModerationLog.get_log_entry_message(second_log_entry) ==
|
||||||
"@#{admin.nickname} updated report ##{second_report_id} (on user @#{
|
"@#{admin.nickname} updated report ##{second_report_id} (on user @#{second_activity.user_actor.nickname}) with 'closed' state"
|
||||||
second_activity.user_actor.nickname
|
|
||||||
}) with 'closed' state"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -160,11 +160,7 @@ test "works for text/markdown with mentions" do
|
||||||
{output, _, _} = Utils.format_input(text, "text/markdown")
|
{output, _, _} = Utils.format_input(text, "text/markdown")
|
||||||
|
|
||||||
assert output ==
|
assert output ==
|
||||||
~s(<p><strong>hello world</strong></p><p><em>another <span class="h-card"><a class="u-url mention" data-user="#{
|
~s(<p><strong>hello world</strong></p><p><em>another <span class="h-card"><a class="u-url mention" data-user="#{user.id}" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> and <span class="h-card"><a class="u-url mention" data-user="#{user.id}" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> <a href="http://google.com" rel="ugc">google.com</a> paragraph</em></p>)
|
||||||
user.id
|
|
||||||
}" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> and <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
user.id
|
|
||||||
}" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> <a href="http://google.com" rel="ugc">google.com</a> paragraph</em></p>)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -201,11 +197,7 @@ test "local mentions" do
|
||||||
{result, _, []} = Utils.format_input(code, "text/markdown")
|
{result, _, []} = Utils.format_input(code, "text/markdown")
|
||||||
|
|
||||||
assert result ==
|
assert result ==
|
||||||
~s[<p><span class="h-card"><a class="u-url mention" data-user="#{mario.id}" href="#{
|
~s[<p><span class="h-card"><a class="u-url mention" data-user="#{mario.id}" href="#{mario.ap_id}" rel="ugc">@<span>mario</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{luigi.id}" href="#{luigi.ap_id}" rel="ugc">@<span>luigi</span></a></span> yo what’s up?</p>]
|
||||||
mario.ap_id
|
|
||||||
}" rel="ugc">@<span>mario</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
luigi.id
|
|
||||||
}" href="#{luigi.ap_id}" rel="ugc">@<span>luigi</span></a></span> yo what’s up?</p>]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "remote mentions" do
|
test "remote mentions" do
|
||||||
|
@ -216,11 +208,7 @@ test "remote mentions" do
|
||||||
{result, _, []} = Utils.format_input(code, "text/markdown")
|
{result, _, []} = Utils.format_input(code, "text/markdown")
|
||||||
|
|
||||||
assert result ==
|
assert result ==
|
||||||
~s[<p><span class="h-card"><a class="u-url mention" data-user="#{mario.id}" href="#{
|
~s[<p><span class="h-card"><a class="u-url mention" data-user="#{mario.id}" href="#{mario.ap_id}" rel="ugc">@<span>mario</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{luigi.id}" href="#{luigi.ap_id}" rel="ugc">@<span>luigi</span></a></span> yo what’s up?</p>]
|
||||||
mario.ap_id
|
|
||||||
}" rel="ugc">@<span>mario</span></a></span> <span class="h-card"><a class="u-url mention" data-user="#{
|
|
||||||
luigi.id
|
|
||||||
}" href="#{luigi.ap_id}" rel="ugc">@<span>luigi</span></a></span> yo what’s up?</p>]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "raw HTML" do
|
test "raw HTML" do
|
||||||
|
|
|
@ -209,9 +209,7 @@ test "it linkifies" do
|
||||||
object = Object.normalize(activity, fetch: false)
|
object = Object.normalize(activity, fetch: false)
|
||||||
|
|
||||||
assert object.data["content"] ==
|
assert object.data["content"] ==
|
||||||
"<a href=\"https://example.org\" rel=\"ugc\">https://example.org</a> is the site of <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{
|
"<a href=\"https://example.org\" rel=\"ugc\">https://example.org</a> is the site of <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{other_user.id}\" href=\"#{other_user.ap_id}\" rel=\"ugc\">@<span>#{other_user.nickname}</span></a></span> <a class=\"hashtag\" data-tag=\"2hu\" href=\"http://localhost:4001/tag/2hu\">#2hu</a>"
|
||||||
other_user.id
|
|
||||||
}\" href=\"#{other_user.ap_id}\" rel=\"ugc\">@<span>#{other_user.nickname}</span></a></span> <a class=\"hashtag\" data-tag=\"2hu\" href=\"http://localhost:4001/tag/2hu\">#2hu</a>"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it posts a chat message" do
|
test "it posts a chat message" do
|
||||||
|
|
|
@ -709,9 +709,7 @@ test "getting followers, pagination", %{user: user, conn: conn} do
|
||||||
assert [%{"id" => ^follower2_id}, %{"id" => ^follower1_id}] =
|
assert [%{"id" => ^follower2_id}, %{"id" => ^follower1_id}] =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
"/api/v1/accounts/#{user.id}/followers?id=#{user.id}&limit=20&max_id=#{
|
"/api/v1/accounts/#{user.id}/followers?id=#{user.id}&limit=20&max_id=#{follower3_id}"
|
||||||
follower3_id
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,7 @@ test "list of notifications" do
|
||||||
|> get("/api/v1/notifications")
|
|> get("/api/v1/notifications")
|
||||||
|
|
||||||
expected_response =
|
expected_response =
|
||||||
"hi <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{user.id}\" href=\"#{
|
"hi <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{user.id}\" href=\"#{user.ap_id}\" rel=\"ugc\">@<span>#{user.nickname}</span></a></span>"
|
||||||
user.ap_id
|
|
||||||
}\" rel=\"ugc\">@<span>#{user.nickname}</span></a></span>"
|
|
||||||
|
|
||||||
assert [%{"status" => %{"content" => response}} | _rest] =
|
assert [%{"status" => %{"content" => response}} | _rest] =
|
||||||
json_response_and_validate_schema(conn, 200)
|
json_response_and_validate_schema(conn, 200)
|
||||||
|
@ -114,9 +112,7 @@ test "getting a single notification" do
|
||||||
conn = get(conn, "/api/v1/notifications/#{notification.id}")
|
conn = get(conn, "/api/v1/notifications/#{notification.id}")
|
||||||
|
|
||||||
expected_response =
|
expected_response =
|
||||||
"hi <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{user.id}\" href=\"#{
|
"hi <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{user.id}\" href=\"#{user.ap_id}\" rel=\"ugc\">@<span>#{user.nickname}</span></a></span>"
|
||||||
user.ap_id
|
|
||||||
}\" rel=\"ugc\">@<span>#{user.nickname}</span></a></span>"
|
|
||||||
|
|
||||||
assert %{"status" => %{"content" => response}} = json_response_and_validate_schema(conn, 200)
|
assert %{"status" => %{"content" => response}} = json_response_and_validate_schema(conn, 200)
|
||||||
assert response == expected_response
|
assert response == expected_response
|
||||||
|
|
|
@ -125,13 +125,7 @@ test "constructs hashtags from search query", %{conn: conn} do
|
||||||
results =
|
results =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
"/api/v2/search?#{
|
"/api/v2/search?#{URI.encode_query(%{q: "https://www.washingtonpost.com/sports/2020/06/10/" <> "nascar-ban-display-confederate-flag-all-events-properties/"})}"
|
||||||
URI.encode_query(%{
|
|
||||||
q:
|
|
||||||
"https://www.washingtonpost.com/sports/2020/06/10/" <>
|
|
||||||
"nascar-ban-display-confederate-flag-all-events-properties/"
|
|
||||||
})
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
@ -156,9 +150,7 @@ test "supports pagination of hashtags search results", %{conn: conn} do
|
||||||
results =
|
results =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
"/api/v2/search?#{
|
"/api/v2/search?#{URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1})}"
|
||||||
URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1})
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,7 @@ test "updates the user's bio", %{conn: conn} do
|
||||||
assert user_data = json_response_and_validate_schema(conn, 200)
|
assert user_data = json_response_and_validate_schema(conn, 200)
|
||||||
|
|
||||||
assert user_data["note"] ==
|
assert user_data["note"] ==
|
||||||
~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe">#cofe</a> with <span class="h-card"><a class="u-url mention" data-user="#{
|
~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe">#cofe</a> with <span class="h-card"><a class="u-url mention" data-user="#{user2.id}" href="#{user2.ap_id}" rel="ugc">@<span>#{user2.nickname}</span></a></span><br/><br/>suya..)
|
||||||
user2.id
|
|
||||||
}" href="#{user2.ap_id}" rel="ugc">@<span>#{user2.nickname}</span></a></span><br/><br/>suya..)
|
|
||||||
|
|
||||||
assert user_data["source"]["note"] == raw_bio
|
assert user_data["source"]["note"] == raw_bio
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,7 @@ def assert_dependencies_installed do
|
||||||
missing_dependencies = Pleroma.Helpers.MediaHelper.missing_dependencies()
|
missing_dependencies = Pleroma.Helpers.MediaHelper.missing_dependencies()
|
||||||
|
|
||||||
assert missing_dependencies == [],
|
assert missing_dependencies == [],
|
||||||
"Error: missing dependencies (please refer to `docs/installation`): #{
|
"Error: missing dependencies (please refer to `docs/installation`): #{inspect(missing_dependencies)}"
|
||||||
inspect(missing_dependencies)
|
|
||||||
}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
|
|
@ -174,9 +174,7 @@ test "paginates favorites using since_id and max_id", %{
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
"/api/v1/pleroma/accounts/#{user.id}/favourites?since_id=#{third_activity.id}&max_id=#{
|
"/api/v1/pleroma/accounts/#{user.id}/favourites?since_id=#{third_activity.id}&max_id=#{seventh_activity.id}"
|
||||||
seventh_activity.id
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,7 @@ test "s3 signed url is parsed and correct ttl is set for rich media" do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp construct_s3_url(timestamp, valid_till) do
|
defp construct_s3_url(timestamp, valid_till) do
|
||||||
"https://pleroma.s3.ap-southeast-1.amazonaws.com/sachin%20%281%29%20_a%20-%25%2Aasdasd%20BNN%20bnnn%20.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIBLWWK6RGDQXDLJQ%2F20190716%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=#{
|
"https://pleroma.s3.ap-southeast-1.amazonaws.com/sachin%20%281%29%20_a%20-%25%2Aasdasd%20BNN%20bnnn%20.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIBLWWK6RGDQXDLJQ%2F20190716%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=#{timestamp}&X-Amz-Expires=#{valid_till}&X-Amz-Signature=04ffd6b98634f4b1bbabc62e0fac4879093cd54a6eed24fe8eb38e8369526bbf&X-Amz-SignedHeaders=host"
|
||||||
timestamp
|
|
||||||
}&X-Amz-Expires=#{valid_till}&X-Amz-Signature=04ffd6b98634f4b1bbabc62e0fac4879093cd54a6eed24fe8eb38e8369526bbf&X-Amz-SignedHeaders=host"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp construct_metadata(timestamp, valid_till, url) do
|
defp construct_metadata(timestamp, valid_till, url) do
|
||||||
|
|
|
@ -139,9 +139,7 @@ test "it registers a new user and parses mentions in the bio" do
|
||||||
{:ok, user2} = TwitterAPI.register_user(data2)
|
{:ok, user2} = TwitterAPI.register_user(data2)
|
||||||
|
|
||||||
expected_text =
|
expected_text =
|
||||||
~s(<span class="h-card"><a class="u-url mention" data-user="#{user1.id}" href="#{
|
~s(<span class="h-card"><a class="u-url mention" data-user="#{user1.id}" href="#{user1.ap_id}" rel="ugc">@<span>john</span></a></span> test)
|
||||||
user1.ap_id
|
|
||||||
}" rel="ugc">@<span>john</span></a></span> test)
|
|
||||||
|
|
||||||
assert user2.bio == expected_text
|
assert user2.bio == expected_text
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,11 +26,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
|
||||||
test "it updates notification settings", %{user: user, conn: conn} do
|
test "it updates notification settings", %{user: user, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put(
|
|> put(
|
||||||
"/api/pleroma/notification_settings?#{
|
"/api/pleroma/notification_settings?#{URI.encode_query(%{block_from_strangers: true})}"
|
||||||
URI.encode_query(%{
|
|
||||||
block_from_strangers: true
|
|
||||||
})
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
|
@ -45,11 +41,7 @@ test "it updates notification settings", %{user: user, conn: conn} do
|
||||||
test "it updates notification settings to enable hiding contents", %{user: user, conn: conn} do
|
test "it updates notification settings to enable hiding contents", %{user: user, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put(
|
|> put(
|
||||||
"/api/pleroma/notification_settings?#{
|
"/api/pleroma/notification_settings?#{URI.encode_query(%{hide_notification_contents: 1})}"
|
||||||
URI.encode_query(%{
|
|
||||||
hide_notification_contents: 1
|
|
||||||
})
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,7 @@ test "GET host-meta" do
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
|
|
||||||
assert response.resp_body ==
|
assert response.resp_body ==
|
||||||
~s(<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="#{
|
~s(<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="#{Pleroma.Web.Endpoint.url()}/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /></XRD>)
|
||||||
Pleroma.Web.Endpoint.url()
|
|
||||||
}/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /></XRD>)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "Webfinger JRD" do
|
test "Webfinger JRD" do
|
||||||
|
|
|
@ -29,9 +29,7 @@ def assert_schema(value, schema) do
|
||||||
end)
|
end)
|
||||||
|
|
||||||
flunk(
|
flunk(
|
||||||
"Value does not conform to schema #{schema.title}: #{Enum.join(errors, "\n")}\n#{
|
"Value does not conform to schema #{schema.title}: #{Enum.join(errors, "\n")}\n#{inspect(value)}"
|
||||||
inspect(value)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,9 +102,7 @@ defp json_response_and_validate_schema(
|
||||||
end)
|
end)
|
||||||
|
|
||||||
flunk(
|
flunk(
|
||||||
"Response does not conform to schema of #{op_id} operation: #{
|
"Response does not conform to schema of #{op_id} operation: #{Enum.join(errors, "\n")}\n#{inspect(json)}"
|
||||||
Enum.join(errors, "\n")
|
|
||||||
}\n#{inspect(json)}"
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1313,9 +1313,7 @@ def get("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", _, _, _
|
||||||
|
|
||||||
def get(url, query, body, headers) do
|
def get(url, query, body, headers) do
|
||||||
{:error,
|
{:error,
|
||||||
"Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
"Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
|
||||||
inspect(headers)
|
|
||||||
}"}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST Requests
|
# POST Requests
|
||||||
|
@ -1381,9 +1379,7 @@ def post("http://404.site" <> _, _, _, _) do
|
||||||
|
|
||||||
def post(url, query, body, headers) do
|
def post(url, query, body, headers) do
|
||||||
{:error,
|
{:error,
|
||||||
"Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
"Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
|
||||||
inspect(headers)
|
|
||||||
}"}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Most of the rich media mocks are missing HEAD requests, so we just return 404.
|
# Most of the rich media mocks are missing HEAD requests, so we just return 404.
|
||||||
|
@ -1398,8 +1394,6 @@ def head(url, _query, _body, _headers) when url in @rich_media_mocks do
|
||||||
|
|
||||||
def head(url, query, body, headers) do
|
def head(url, query, body, headers) do
|
||||||
{:error,
|
{:error,
|
||||||
"Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
"Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}
|
||||||
inspect(headers)
|
|
||||||
}"}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue