aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-04-14 16:32:34 +0000
committerlain <lain@soykaf.club>2020-04-14 16:32:34 +0000
commitc02e6ceea567b3ae7a5492ebd4d0babb798a13b4 (patch)
treebdabe459c11fd9ef2f79402c6a454c3ca04fb341 /test
parent3677a1e5785e8a753652debf37b2818e622f9ffd (diff)
parent4576520461e2e3a1c78133aaf31cb742a2a1a689 (diff)
downloadpleroma-c02e6ceea567b3ae7a5492ebd4d0babb798a13b4.tar.gz
Merge branch 'revert-60cc7d6c' into 'develop'
Revert "Merge branch 'issue/1276' into 'develop'" See merge request pleroma/pleroma!2384
Diffstat (limited to 'test')
-rw-r--r--test/marker_test.exs29
-rw-r--r--test/notification_test.exs13
-rw-r--r--test/web/mastodon_api/controllers/marker_controller_test.exs10
-rw-r--r--test/web/mastodon_api/views/marker_view_test.exs8
4 files changed, 7 insertions, 53 deletions
diff --git a/test/marker_test.exs b/test/marker_test.exs
index 5b6d0b4a4..c80ae16b6 100644
--- a/test/marker_test.exs
+++ b/test/marker_test.exs
@@ -8,39 +8,12 @@ defmodule Pleroma.MarkerTest do
import Pleroma.Factory
- describe "multi_set_unread_count/3" do
- test "returns multi" do
- user = insert(:user)
-
- assert %Ecto.Multi{
- operations: [marker: {:run, _}, counters: {:run, _}]
- } =
- Marker.multi_set_last_read_id(
- Ecto.Multi.new(),
- user,
- "notifications"
- )
- end
-
- test "return empty multi" do
- user = insert(:user)
- multi = Ecto.Multi.new()
- assert Marker.multi_set_last_read_id(multi, user, "home") == multi
- end
- end
-
describe "get_markers/2" do
test "returns user markers" do
user = insert(:user)
marker = insert(:marker, user: user)
- insert(:notification, user: user)
- insert(:notification, user: user)
insert(:marker, timeline: "home", user: user)
-
- assert Marker.get_markers(
- user,
- ["notifications"]
- ) == [%Marker{refresh_record(marker) | unread_count: 2}]
+ assert Marker.get_markers(user, ["notifications"]) == [refresh_record(marker)]
end
end
diff --git a/test/notification_test.exs b/test/notification_test.exs
index f78a47af6..837a9dacd 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -45,9 +45,6 @@ defmodule Pleroma.NotificationTest do
assert notified_ids == [other_user.id, third_user.id]
assert notification.activity_id == activity.id
assert other_notification.activity_id == activity.id
-
- assert [%Pleroma.Marker{unread_count: 2}] =
- Pleroma.Marker.get_markers(other_user, ["notifications"])
end
test "it creates a notification for subscribed users" do
@@ -413,16 +410,6 @@ defmodule Pleroma.NotificationTest do
assert n1.seen == true
assert n2.seen == true
assert n3.seen == false
-
- assert %Pleroma.Marker{} =
- m =
- Pleroma.Repo.get_by(
- Pleroma.Marker,
- user_id: other_user.id,
- timeline: "notifications"
- )
-
- assert m.last_read_id == to_string(n2.id)
end
end
diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/web/mastodon_api/controllers/marker_controller_test.exs
index 7280abd10..919f295bd 100644
--- a/test/web/mastodon_api/controllers/marker_controller_test.exs
+++ b/test/web/mastodon_api/controllers/marker_controller_test.exs
@@ -11,7 +11,6 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
test "gets markers with correct scopes", %{conn: conn} do
user = insert(:user)
token = insert(:oauth_token, user: user, scopes: ["read:statuses"])
- insert_list(7, :notification, user: user)
{:ok, %{"notifications" => marker}} =
Pleroma.Marker.upsert(
@@ -30,8 +29,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"notifications" => %{
"last_read_id" => "69420",
"updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
- "version" => 0,
- "pleroma" => %{"unread_count" => 7}
+ "version" => 0
}
}
end
@@ -72,8 +70,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"notifications" => %{
"last_read_id" => "69420",
"updated_at" => _,
- "version" => 0,
- "pleroma" => %{"unread_count" => 0}
+ "version" => 0
}
} = response
end
@@ -102,8 +99,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"notifications" => %{
"last_read_id" => "69888",
"updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
- "version" => 0,
- "pleroma" => %{"unread_count" => 0}
+ "version" => 0
}
}
end
diff --git a/test/web/mastodon_api/views/marker_view_test.exs b/test/web/mastodon_api/views/marker_view_test.exs
index 48a0a6d33..893cf8857 100644
--- a/test/web/mastodon_api/views/marker_view_test.exs
+++ b/test/web/mastodon_api/views/marker_view_test.exs
@@ -8,21 +8,19 @@ defmodule Pleroma.Web.MastodonAPI.MarkerViewTest do
import Pleroma.Factory
test "returns markers" do
- marker1 = insert(:marker, timeline: "notifications", last_read_id: "17", unread_count: 5)
+ marker1 = insert(:marker, timeline: "notifications", last_read_id: "17")
marker2 = insert(:marker, timeline: "home", last_read_id: "42")
assert MarkerView.render("markers.json", %{markers: [marker1, marker2]}) == %{
"home" => %{
last_read_id: "42",
updated_at: NaiveDateTime.to_iso8601(marker2.updated_at),
- version: 0,
- pleroma: %{unread_count: 0}
+ version: 0
},
"notifications" => %{
last_read_id: "17",
updated_at: NaiveDateTime.to_iso8601(marker1.updated_at),
- version: 0,
- pleroma: %{unread_count: 5}
+ version: 0
}
}
end