Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/help-test
authordtluna <dtluna@openmailbox.org>
Sun, 16 Apr 2017 14:10:25 +0000 (17:10 +0300)
committerdtluna <dtluna@openmailbox.org>
Sun, 16 Apr 2017 14:10:25 +0000 (17:10 +0300)
1  2 
lib/pleroma/web/router.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex
test/web/twitter_api/twitter_api_controller_test.exs

Simple merge
index e54177c9414da79f120b289c334bdfaca0dad433,f9723dd9fa94e93269456d2b38e357babaee366c..6c48b55972ce30907480b3aed46b2399bcadab86
@@@ -157,12 -157,24 +157,30 @@@ defmodule Pleroma.Web.TwitterAPI.Contro
      end
    end
  
 +  describe "GET /help/test.json" do
 +    test "returns \"ok\"", %{conn: conn} do
 +      conn = get conn, "/api/help/test.json"
 +      assert json_response(conn, 200) == "ok"
 +  end
 +
+   describe "POST /api/qvitter/update_avatar.json" do
+     setup [:valid_user]
+     test "without valid credentials", %{conn: conn} do
+       conn = post conn, "/api/qvitter/update_avatar.json"
+       assert json_response(conn, 403) == %{"error" => "Invalid credentials."}
+     end
+     test "with credentials", %{conn: conn, user: current_user} do
+       conn = conn
+       |> with_credentials(current_user.nickname, "test")
+       |> post("/api/qvitter/update_avatar.json", %{img: Pleroma.Web.ActivityPub.ActivityPubTest.data_uri})
+       current_user = Repo.get(User, current_user.id)
+       assert is_map(current_user.avatar)
+       assert json_response(conn, 200) == UserRepresenter.to_map(current_user, %{for: current_user})
+     end
+   end
    describe "POST /api/favorites/create/:id" do
      setup [:valid_user]
      test "without valid credentials", %{conn: conn} do