From 9223038319f0281f104fb9bb85c0cb8f6e52984a Mon Sep 17 00:00:00 2001 From: eal Date: Mon, 11 Dec 2017 21:01:36 +0200 Subject: Fix some more tests. --- test/web/twitter_api/views/user_view_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/web/twitter_api/views') diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 18a19ef70..753e41d20 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -30,8 +30,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do User.follow(follower, user) User.follow(second_follower, user) User.follow(user, follower) - - user = Repo.get!(User, user.id) + {:ok, user} = User.update_follower_count(user) + Cachex.set(:user_cache, "user_info:#{user.id}", User.user_info(Repo.get!(User, user.id))) image = "https://placehold.it/48x48" -- cgit v1.2.3 From 14b086eec22486d1efc8248f5f157696e7621e5b Mon Sep 17 00:00:00 2001 From: eal Date: Mon, 15 Jan 2018 22:18:17 +0200 Subject: Add a default profile picture and banner. This removes the placehold.it dependency. --- test/web/twitter_api/views/user_view_test.exs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'test/web/twitter_api/views') diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 753e41d20..3f84e4116 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -33,7 +33,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do {:ok, user} = User.update_follower_count(user) Cachex.set(:user_cache, "user_info:#{user.id}", User.user_info(Repo.get!(User, user.id))) - image = "https://placehold.it/48x48" + image = "http://localhost:4001/static/avi.png" + banner = "http://localhost:4001/static/banner.png" represented = %{ "id" => user.id, @@ -54,7 +55,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "statusnet_blocking" => false, "rights" => %{}, "statusnet_profile_url" => user.ap_id, - "cover_photo" => nil, + "cover_photo" => banner, "background_image" => nil } @@ -64,7 +65,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do test "A user for a given other follower", %{user: user} do {:ok, follower} = UserBuilder.insert(%{following: [User.ap_followers(user)]}) {:ok, user} = User.update_follower_count(user) - image = "https://placehold.it/48x48" + image = "http://localhost:4001/static/avi.png" + banner = "http://localhost:4001/static/banner.png" + represented = %{ "id" => user.id, "name" => user.name, @@ -84,7 +87,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "statusnet_blocking" => false, "rights" => %{}, "statusnet_profile_url" => user.ap_id, - "cover_photo" => nil, + "cover_photo" => banner, "background_image" => nil } @@ -95,7 +98,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do follower = insert(:user) {:ok, follower} = User.follow(follower, user) {:ok, user} = User.update_follower_count(user) - image = "https://placehold.it/48x48" + image = "http://localhost:4001/static/avi.png" + banner = "http://localhost:4001/static/banner.png" + represented = %{ "id" => follower.id, "name" => follower.name, @@ -115,7 +120,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "statusnet_blocking" => false, "rights" => %{}, "statusnet_profile_url" => follower.ap_id, - "cover_photo" => nil, + "cover_photo" => banner, "background_image" => nil } @@ -126,7 +131,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do user = insert(:user) blocker = insert(:user) User.block(blocker, user) - image = "https://placehold.it/48x48" + image = "http://localhost:4001/static/avi.png" + banner = "http://localhost:4001/static/banner.png" + represented = %{ "id" => user.id, "name" => user.name, @@ -146,7 +153,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "statusnet_blocking" => true, "rights" => %{}, "statusnet_profile_url" => user.ap_id, - "cover_photo" => nil, + "cover_photo" => banner, "background_image" => nil } -- cgit v1.2.3 From ab83e0de6d389428cec11fe94280d675a38f00d0 Mon Sep 17 00:00:00 2001 From: eal Date: Thu, 1 Feb 2018 21:41:19 +0200 Subject: TwitterAPI: Add is_local to user view. --- test/web/twitter_api/views/user_view_test.exs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/web/twitter_api/views') diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 3f84e4116..e68230a86 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -56,7 +56,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: user}) @@ -88,7 +89,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: user, for: follower}) @@ -121,7 +123,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "rights" => %{}, "statusnet_profile_url" => follower.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: follower, for: user}) @@ -154,7 +157,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } blocker = Repo.get(User, blocker.id) -- cgit v1.2.3 From ea6d1b2b172d88b6ea47ab044813d39b053534b2 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sat, 3 Feb 2018 20:43:14 +0900 Subject: move avi.png & banner.png from /priv/static/static to /priv/static/images --- test/web/twitter_api/views/user_view_test.exs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test/web/twitter_api/views') diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 3f84e4116..5aec757bc 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -33,8 +33,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do {:ok, user} = User.update_follower_count(user) Cachex.set(:user_cache, "user_info:#{user.id}", User.user_info(Repo.get!(User, user.id))) - image = "http://localhost:4001/static/avi.png" - banner = "http://localhost:4001/static/banner.png" + image = "http://localhost:4001/images/avi.png" + banner = "http://localhost:4001/images/banner.png" represented = %{ "id" => user.id, @@ -65,8 +65,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do test "A user for a given other follower", %{user: user} do {:ok, follower} = UserBuilder.insert(%{following: [User.ap_followers(user)]}) {:ok, user} = User.update_follower_count(user) - image = "http://localhost:4001/static/avi.png" - banner = "http://localhost:4001/static/banner.png" + image = "http://localhost:4001/images/avi.png" + banner = "http://localhost:4001/images/banner.png" represented = %{ "id" => user.id, @@ -98,8 +98,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do follower = insert(:user) {:ok, follower} = User.follow(follower, user) {:ok, user} = User.update_follower_count(user) - image = "http://localhost:4001/static/avi.png" - banner = "http://localhost:4001/static/banner.png" + image = "http://localhost:4001/images/avi.png" + banner = "http://localhost:4001/images/banner.png" represented = %{ "id" => follower.id, @@ -131,8 +131,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do user = insert(:user) blocker = insert(:user) User.block(blocker, user) - image = "http://localhost:4001/static/avi.png" - banner = "http://localhost:4001/static/banner.png" + image = "http://localhost:4001/images/avi.png" + banner = "http://localhost:4001/images/banner.png" represented = %{ "id" => user.id, -- cgit v1.2.3