fixed tests

This commit is contained in:
Maksim Pechnikov 2020-09-15 15:32:49 +03:00
parent 3e53ab4e98
commit f879d07fa1
5 changed files with 11 additions and 6 deletions

View file

@ -33,8 +33,8 @@ defmodule Pleroma.MarkerTest do
test "returns user markers" do test "returns user markers" do
user = insert(:user) user = insert(:user)
marker = insert(:marker, user: user) marker = insert(:marker, user: user)
insert(:notification, user: user) insert(:notification, user: user, activity: insert(:note_activity))
insert(:notification, user: user) insert(:notification, user: user, activity: insert(:note_activity))
insert(:marker, timeline: "home", user: user) insert(:marker, timeline: "home", user: user)
assert Marker.get_markers( assert Marker.get_markers(

View file

@ -37,7 +37,9 @@ defmodule Pleroma.RepoTest do
test "get one-to-many assoc from repo" do test "get one-to-many assoc from repo" do
user = insert(:user) user = insert(:user)
notification = refresh_record(insert(:notification, user: user))
notification =
refresh_record(insert(:notification, user: user, activity: insert(:note_activity)))
assert Repo.get_assoc(user, :notifications) == {:ok, [notification]} assert Repo.get_assoc(user, :notifications) == {:ok, [notification]}
end end

View file

@ -1442,7 +1442,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
describe "verify_credentials" do describe "verify_credentials" do
test "verify_credentials" do test "verify_credentials" do
%{user: user, conn: conn} = oauth_access(["read:accounts"]) %{user: user, conn: conn} = oauth_access(["read:accounts"])
[notification | _] = insert_list(7, :notification, user: user)
[notification | _] =
insert_list(7, :notification, user: user, activity: insert(:note_activity))
Pleroma.Notification.set_read_up_to(user, notification.id) Pleroma.Notification.set_read_up_to(user, notification.id)
conn = get(conn, "/api/v1/accounts/verify_credentials") conn = get(conn, "/api/v1/accounts/verify_credentials")

View file

@ -11,7 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
test "gets markers with correct scopes", %{conn: conn} do test "gets markers with correct scopes", %{conn: conn} do
user = insert(:user) user = insert(:user)
token = insert(:oauth_token, user: user, scopes: ["read:statuses"]) token = insert(:oauth_token, user: user, scopes: ["read:statuses"])
insert_list(7, :notification, user: user) insert_list(7, :notification, user: user, activity: insert(:note_activity))
{:ok, %{"notifications" => marker}} = {:ok, %{"notifications" => marker}} =
Pleroma.Marker.upsert( Pleroma.Marker.upsert(

View file

@ -448,7 +448,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "shows unread_count only to the account owner" do test "shows unread_count only to the account owner" do
user = insert(:user) user = insert(:user)
insert_list(7, :notification, user: user) insert_list(7, :notification, user: user, activity: insert(:note_activity))
other_user = insert(:user) other_user = insert(:user)
user = User.get_cached_by_ap_id(user.ap_id) user = User.get_cached_by_ap_id(user.ap_id)