summaryrefslogtreecommitdiff
path: root/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/pleroma/web/pleroma_api/controllers/account_controller_test.exs')
-rw-r--r--test/pleroma/web/pleroma_api/controllers/account_controller_test.exs55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs
index d9aa8ce55..15682e40a 100644
--- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs
@@ -304,4 +304,59 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
assert json_response_and_validate_schema(conn, 404) == %{"error" => "Record not found"}
end
end
+
+ describe "birthday reminders" do
+ test "returns a list of friends having birthday on specified day" do
+ %{user: user, conn: conn} = oauth_access(["read:accounts"])
+
+ %{id: id1} =
+ user1 =
+ insert(:user, %{
+ birthday: "2001-02-12",
+ show_birthday: true
+ })
+
+ user2 =
+ insert(:user, %{
+ birthday: "2001-02-14",
+ show_birthday: true
+ })
+
+ user3 = insert(:user)
+
+ CommonAPI.follow(user, user1)
+ CommonAPI.follow(user, user2)
+ CommonAPI.follow(user, user3)
+
+ [%{"id" => ^id1}] =
+ conn
+ |> get("/api/v1/pleroma/birthdays?day=12&month=2")
+ |> json_response_and_validate_schema(:ok)
+ end
+
+ test "the list doesn't list friends with hidden birth date" do
+ %{user: user, conn: conn} = oauth_access(["read:accounts"])
+
+ user1 =
+ insert(:user, %{
+ birthday: "2001-02-12",
+ show_birthday: false
+ })
+
+ %{id: id2} =
+ user2 =
+ insert(:user, %{
+ birthday: "2001-02-12",
+ show_birthday: true
+ })
+
+ CommonAPI.follow(user, user1)
+ CommonAPI.follow(user, user2)
+
+ [%{"id" => ^id2}] =
+ conn
+ |> get("/api/v1/pleroma/birthdays?day=12&month=2")
+ |> json_response_and_validate_schema(:ok)
+ end
+ end
end