X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Fostatus_controller_test.exs;h=f06023dff88e31e3fe515f0bab5e8bcecaf8ce4b;hb=64095961fe490029886cae358683532ea65bf2c0;hp=9f756effb3820b955804e0a5fd4a04b3fab99b3c;hpb=c88a5d32514f4ed78e4b9216198db62e8799ffe4;p=akkoma
diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/web/ostatus/ostatus_controller_test.exs
index 9f756effb..f06023dff 100644
--- a/test/web/ostatus/ostatus_controller_test.exs
+++ b/test/web/ostatus/ostatus_controller_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
@@ -15,16 +15,13 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
-
- config_path = [:instance, :federating]
- initial_setting = Pleroma.Config.get(config_path)
-
- Pleroma.Config.put(config_path, true)
- on_exit(fn -> Pleroma.Config.put(config_path, initial_setting) end)
-
:ok
end
+ clear_config_all([:instance, :federating]) do
+ Pleroma.Config.put([:instance, :federating], true)
+ end
+
describe "salmon_incoming" do
test "decodes a salmon", %{conn: conn} do
user = insert(:user)
@@ -53,20 +50,16 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
assert response(conn, 200)
end) =~ "[error]"
- # Set a wrong magic-key for a user so it has to refetch
- salmon_user = User.get_cached_by_ap_id("http://gs.example.org:4040/index.php/user/1")
-
# Wrong key
- info_cng =
- User.Info.remote_user_creation(salmon_user.info, %{
- magic_key:
- "RSA.pu0s-halox4tu7wmES1FVSx6u-4wc0YrUFXcqWXZG4-27UmbCOpMQftRCldNRfyA-qLbz-eqiwrong1EwUvjsD4cYbAHNGHwTvDOyx5AKthQUP44ykPv7kjKGh3DWKySJvcs9tlUG87hlo7AvnMo9pwRS_Zz2CacQ-MKaXyDepk=.AQAB"
- })
+ info = %{
+ magic_key:
+ "RSA.pu0s-halox4tu7wmES1FVSx6u-4wc0YrUFXcqWXZG4-27UmbCOpMQftRCldNRfyA-qLbz-eqiwrong1EwUvjsD4cYbAHNGHwTvDOyx5AKthQUP44ykPv7kjKGh3DWKySJvcs9tlUG87hlo7AvnMo9pwRS_Zz2CacQ-MKaXyDepk=.AQAB"
+ }
- salmon_user
- |> Ecto.Changeset.change()
- |> Ecto.Changeset.put_embed(:info, info_cng)
- |> User.update_and_set_cache()
+ # Set a wrong magic-key for a user so it has to refetch
+ "http://gs.example.org:4040/index.php/user/1"
+ |> User.get_cached_by_ap_id()
+ |> User.update_info(&User.Info.remote_user_creation(&1, info))
assert capture_log(fn ->
conn =
@@ -403,7 +396,8 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
"oauthAuthorizationEndpoint" => "#{Pleroma.Web.base_url()}/oauth/authorize",
"oauthRegistrationEndpoint" => "#{Pleroma.Web.base_url()}/api/v1/apps",
"oauthTokenEndpoint" => "#{Pleroma.Web.base_url()}/oauth/token",
- "sharedInbox" => "#{Pleroma.Web.base_url()}/inbox"
+ "sharedInbox" => "#{Pleroma.Web.base_url()}/inbox",
+ "uploadMedia" => "#{Pleroma.Web.base_url()}/api/ap/upload_media"
}
assert response["@context"] == [
@@ -465,7 +459,8 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
"oauthAuthorizationEndpoint" => "#{Pleroma.Web.base_url()}/oauth/authorize",
"oauthRegistrationEndpoint" => "#{Pleroma.Web.base_url()}/api/v1/apps",
"oauthTokenEndpoint" => "#{Pleroma.Web.base_url()}/oauth/token",
- "sharedInbox" => "#{Pleroma.Web.base_url()}/inbox"
+ "sharedInbox" => "#{Pleroma.Web.base_url()}/inbox",
+ "uploadMedia" => "#{Pleroma.Web.base_url()}/api/ap/upload_media"
}
assert response["@context"] == [