From 5bd3b3a215bc0b1e55a99a32c799e1273039cb22 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 27 Nov 2018 18:21:05 +0100 Subject: [PATCH] More and more fixes. --- test/web/node_info_test.exs | 6 +++--- test/web/ostatus/ostatus_controller_test.exs | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/web/node_info_test.exs b/test/web/node_info_test.exs index a6376453c..a5b0b7869 100644 --- a/test/web/node_info_test.exs +++ b/test/web/node_info_test.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Web.NodeInfoTest do import Pleroma.Factory test "nodeinfo shows staff accounts", %{conn: conn} do - user = insert(:user, %{local: true, info: %{"is_moderator" => true}}) + user = insert(:user, %{local: true, info: %{is_moderator: true}}) conn = conn @@ -15,7 +15,7 @@ test "nodeinfo shows staff accounts", %{conn: conn} do assert user.ap_id in result["metadata"]["staffAccounts"] end - test "returns 404 when federation is disabled" do + test "returns 404 when federation is disabled", %{conn: conn} do instance = Application.get_env(:pleroma, :instance) |> Keyword.put(:federating, false) @@ -37,7 +37,7 @@ test "returns 404 when federation is disabled" do Application.put_env(:pleroma, :instance, instance) end - test "returns 200 when federation is enabled" do + test "returns 200 when federation is enabled", %{conn: conn} do conn |> get("/.well-known/nodeinfo") |> json_response(200) diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/web/ostatus/ostatus_controller_test.exs index 371c835c0..e81adde68 100644 --- a/test/web/ostatus/ostatus_controller_test.exs +++ b/test/web/ostatus/ostatus_controller_test.exs @@ -31,14 +31,16 @@ test "decodes a salmon with a changed magic key", %{conn: conn} do # Set a wrong magic-key for a user so it has to refetch salmon_user = User.get_by_ap_id("http://gs.example.org:4040/index.php/user/1") # Wrong key - info = - salmon_user.info - |> Map.put( - "magic_key", - "RSA.pu0s-halox4tu7wmES1FVSx6u-4wc0YrUFXcqWXZG4-27UmbCOpMQftRCldNRfyA-qLbz-eqiwrong1EwUvjsD4cYbAHNGHwTvDOyx5AKthQUP44ykPv7kjKGh3DWKySJvcs9tlUG87hlo7AvnMo9pwRS_Zz2CacQ-MKaXyDepk=.AQAB" - ) + info_cng = + User.Info.remote_user_creation(salmon_user.info, %{ + magic_key: + "RSA.pu0s-halox4tu7wmES1FVSx6u-4wc0YrUFXcqWXZG4-27UmbCOpMQftRCldNRfyA-qLbz-eqiwrong1EwUvjsD4cYbAHNGHwTvDOyx5AKthQUP44ykPv7kjKGh3DWKySJvcs9tlUG87hlo7AvnMo9pwRS_Zz2CacQ-MKaXyDepk=.AQAB" + }) - Repo.update(User.info_changeset(salmon_user, %{info: info})) + cng = + Ecto.Changeset.change(salmon_user) + |> Ecto.Changeset.put_embed(:info, info_cng) + |> Repo.update() conn = build_conn()