forked from potsda.mn/mobilizon
test: fix tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
f47889b5e0
commit
c731f0f084
|
@ -110,10 +110,13 @@ defmodule Mobilizon.Posts do
|
||||||
def update_post(%Post{} = post, attrs) do
|
def update_post(%Post{} = post, attrs) do
|
||||||
Cachable.clear_all_caches(post)
|
Cachable.clear_all_caches(post)
|
||||||
|
|
||||||
post
|
with {:ok, %Post{} = post} <-
|
||||||
|> Repo.preload([:tags, :media])
|
post
|
||||||
|> Post.changeset(attrs)
|
|> Repo.preload(@post_preloads)
|
||||||
|> Repo.update()
|
|> Post.changeset(attrs)
|
||||||
|
|> Repo.update() do
|
||||||
|
{:ok, Repo.preload(post, @post_preloads)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -8,7 +8,7 @@ defmodule Mobilizon.Service.Export.ICalendar do
|
||||||
alias Mobilizon.{Config, Events}
|
alias Mobilizon.{Config, Events}
|
||||||
alias Mobilizon.Events.{Event, EventOptions}
|
alias Mobilizon.Events.{Event, EventOptions}
|
||||||
alias Mobilizon.Service.Export.{Cachable, Common}
|
alias Mobilizon.Service.Export.{Cachable, Common}
|
||||||
alias Mobilizon.Service.Formatter.{HTML, Text}
|
alias Mobilizon.Service.Formatter.HTML
|
||||||
|
|
||||||
@behaviour Cachable
|
@behaviour Cachable
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,12 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.PostsTest do
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
import Mox
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier}
|
alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier}
|
||||||
alias Mobilizon.Federation.ActivityStream.Convertible
|
alias Mobilizon.Federation.ActivityStream.Convertible
|
||||||
alias Mobilizon.Posts.Post
|
alias Mobilizon.Posts.Post
|
||||||
|
|
||||||
describe "handle incoming posts" do
|
describe "handle incoming posts" do
|
||||||
setup :verify_on_exit!
|
|
||||||
|
|
||||||
test "it ignores an incoming post if we already have it" do
|
test "it ignores an incoming post if we already have it" do
|
||||||
post = insert(:post)
|
post = insert(:post)
|
||||||
post = Repo.preload(post, [:author, :attributed_to, :picture, :media])
|
post = Repo.preload(post, [:author, :attributed_to, :picture, :media])
|
||||||
|
|
|
@ -187,17 +187,18 @@ defmodule Mobilizon.Service.Workers.LegacyNotifierBuilderTest do
|
||||||
"object_id" => to_string(comment_id)
|
"object_id" => to_string(comment_id)
|
||||||
})
|
})
|
||||||
|
|
||||||
NotifierMock
|
# # Disabled as announcement is sent straight away
|
||||||
|> expect(:ready?, fn -> true end)
|
# NotifierMock
|
||||||
|> expect(:send, fn %User{},
|
# |> expect(:ready?, fn -> true end)
|
||||||
%Activity{
|
# |> expect(:send, fn %User{},
|
||||||
type: :comment,
|
# %Activity{
|
||||||
subject: :participation_event_comment,
|
# type: :comment,
|
||||||
object_type: :comment
|
# subject: :participation_event_comment,
|
||||||
},
|
# object_type: :comment
|
||||||
[single_activity: true] ->
|
# },
|
||||||
{:ok, :sent}
|
# [single_activity: true] ->
|
||||||
end)
|
# {:ok, :sent}
|
||||||
|
# end)
|
||||||
|
|
||||||
assert :ok == LegacyNotifierBuilder.perform(%Oban.Job{args: args})
|
assert :ok == LegacyNotifierBuilder.perform(%Oban.Job{args: args})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue