diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-04-16 16:06:19 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-04-16 16:06:19 +0200 |
commit | eb9358c8d6159d6ffe9dc3b20d371ca1a81baf5b (patch) | |
tree | 9a901eeadfd0ddd21b6bd2e2fee99f048dc67d95 /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | 03a9c11d25a33eddd89175578617da1f2f766088 (diff) | |
download | pleroma-eb9358c8d6159d6ffe9dc3b20d371ca1a81baf5b.tar.gz |
Add basic Avatar updating code.
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 3751ee703..f9723dd9f 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -157,6 +157,24 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end 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 |