Birthdays: birth_date --> birthday
This commit is contained in:
parent
74cf0f0355
commit
66e8c6f90f
19 changed files with 92 additions and 92 deletions
|
|
@ -755,7 +755,7 @@ defmodule Pleroma.UserTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "user registration, with :birth_date_required and :birth_date_min_age" do
|
||||
describe "user registration, with :birthday_required and :birthday_min_age" do
|
||||
@full_user_data %{
|
||||
bio: "A guy",
|
||||
name: "my name",
|
||||
|
|
@ -766,17 +766,17 @@ defmodule Pleroma.UserTest do
|
|||
}
|
||||
|
||||
setup do
|
||||
clear_config([:instance, :birth_date_required], true)
|
||||
clear_config([:instance, :birth_date_min_age], 18 * 365)
|
||||
clear_config([:instance, :birthday_required], true)
|
||||
clear_config([:instance, :birthday_min_age], 18 * 365)
|
||||
end
|
||||
|
||||
test "it passes when correct birth date is provided" do
|
||||
today = Date.utc_today()
|
||||
birth_date = Date.add(today, -19 * 365)
|
||||
birthday = Date.add(today, -19 * 365)
|
||||
|
||||
params =
|
||||
@full_user_data
|
||||
|> Map.put(:birth_date, birth_date)
|
||||
|> Map.put(:birthday, birthday)
|
||||
|
||||
changeset = User.register_changeset(%User{}, params)
|
||||
|
||||
|
|
@ -791,11 +791,11 @@ defmodule Pleroma.UserTest do
|
|||
|
||||
test "it fails when provided invalid birth date" do
|
||||
today = Date.utc_today()
|
||||
birth_date = Date.add(today, -17 * 365)
|
||||
birthday = Date.add(today, -17 * 365)
|
||||
|
||||
params =
|
||||
@full_user_data
|
||||
|> Map.put(:birth_date, birth_date)
|
||||
|> Map.put(:birthday, birthday)
|
||||
|
||||
changeset = User.register_changeset(%User{}, params)
|
||||
|
||||
|
|
|
|||
|
|
@ -1588,8 +1588,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
|
||||
describe "create account with required birth date" do
|
||||
setup %{conn: conn} do
|
||||
clear_config([:instance, :birth_date_required], true)
|
||||
clear_config([:instance, :birth_date_min_age], 18 * 365)
|
||||
clear_config([:instance, :birthday_required], true)
|
||||
clear_config([:instance, :birthday_min_age], 18 * 365)
|
||||
|
||||
app_token = insert(:oauth_token, user: nil)
|
||||
|
||||
|
|
@ -1602,7 +1602,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
end
|
||||
|
||||
test "creates an account if provided valid birth date", %{conn: conn} do
|
||||
birth_date =
|
||||
birthday =
|
||||
Date.utc_today()
|
||||
|> Date.add(-19 * 365)
|
||||
|> Date.to_string()
|
||||
|
|
@ -1612,7 +1612,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
email: "mkljczk@example.org",
|
||||
password: "dupa.8",
|
||||
agreement: true,
|
||||
birth_date: birth_date
|
||||
birthday: birthday
|
||||
}
|
||||
|
||||
res =
|
||||
|
|
@ -1635,7 +1635,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
|> post("/api/v1/accounts", params)
|
||||
|
||||
assert json_response_and_validate_schema(res, 400) == %{
|
||||
"error" => "{\"birth_date\":[\"can't be blank\"]}"
|
||||
"error" => "{\"birthday\":[\"can't be blank\"]}"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -370,24 +370,24 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|
|||
]
|
||||
end
|
||||
|
||||
test "updates birth date", %{conn: conn, user: user} do
|
||||
test "updates birth date", %{conn: conn} do
|
||||
res =
|
||||
patch(conn, "/api/v1/accounts/update_credentials", %{
|
||||
"birth_date" => "2001-02-12"
|
||||
"birthday" => "2001-02-12"
|
||||
})
|
||||
|
||||
assert user_data = json_response_and_validate_schema(res, 200)
|
||||
assert user_data["pleroma"]["birth_date"] == "2001-02-12"
|
||||
assert user_data["pleroma"]["birthday"] == "2001-02-12"
|
||||
end
|
||||
|
||||
test "updates the user's hide_birth_date status", %{conn: conn} do
|
||||
test "updates the user's hide_birthday status", %{conn: conn} do
|
||||
res =
|
||||
patch(conn, "/api/v1/accounts/update_credentials", %{
|
||||
"hide_birth_date" => true
|
||||
"hide_birthday" => true
|
||||
})
|
||||
|
||||
assert user_data = json_response_and_validate_schema(res, 200)
|
||||
assert user_data["pleroma"]["hide_birth_date"] == true
|
||||
assert user_data["pleroma"]["hide_birthday"] == true
|
||||
end
|
||||
|
||||
test "emojis in fields labels", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
ap_id: user.ap_id,
|
||||
also_known_as: ["https://shitposter.zone/users/shp"],
|
||||
background_image: "https://example.com/images/asuka_hospital.png",
|
||||
birth_date: nil,
|
||||
birthday: nil,
|
||||
favicon: nil,
|
||||
is_confirmed: true,
|
||||
tags: [],
|
||||
|
|
@ -182,7 +182,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
ap_id: user.ap_id,
|
||||
also_known_as: [],
|
||||
background_image: nil,
|
||||
birth_date: nil,
|
||||
birthday: nil,
|
||||
favicon: nil,
|
||||
is_confirmed: true,
|
||||
tags: [],
|
||||
|
|
|
|||
|
|
@ -312,12 +312,12 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
|
|||
%{id: id1} =
|
||||
user1 =
|
||||
insert(:user, %{
|
||||
birth_date: "2001-02-12"
|
||||
birthday: "2001-02-12"
|
||||
})
|
||||
|
||||
user2 =
|
||||
insert(:user, %{
|
||||
birth_date: "2001-02-14"
|
||||
birthday: "2001-02-14"
|
||||
})
|
||||
|
||||
user3 = insert(:user)
|
||||
|
|
@ -337,15 +337,15 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
|
|||
|
||||
user1 =
|
||||
insert(:user, %{
|
||||
birth_date: "2001-02-12",
|
||||
hide_birth_date: true
|
||||
birthday: "2001-02-12",
|
||||
hide_birthday: true
|
||||
})
|
||||
|
||||
%{id: id2} =
|
||||
user2 =
|
||||
insert(:user, %{
|
||||
birth_date: "2001-02-12",
|
||||
hide_birth_date: false
|
||||
birthday: "2001-02-12",
|
||||
hide_birthday: false
|
||||
})
|
||||
|
||||
CommonAPI.follow(user, user1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue