From: dtluna Date: Sun, 16 Apr 2017 14:10:25 +0000 (+0300) Subject: Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/help-test X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=85bd480be333896ca9cc0ade0e68ea99e10aaaa7;p=akkoma Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/help-test --- 85bd480be333896ca9cc0ade0e68ea99e10aaaa7 diff --cc test/web/twitter_api/twitter_api_controller_test.exs index e54177c94,f9723dd9f..6c48b5597 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@@ -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