Fix software design suggestions
This commit is contained in:
committed by
Thomas Citharel
parent
aed824f1aa
commit
0a0d07cf38
@@ -16,8 +16,11 @@ defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.Events.Event
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias Mobilizon.Service.ActivityPub.Converter
|
||||
alias Mobilizon.Service.HTTPSignatures.Signature
|
||||
|
||||
alias MobilizonWeb.ActivityPub.ActorView
|
||||
|
||||
setup_all do
|
||||
HTTPoison.start()
|
||||
end
|
||||
@@ -162,7 +165,7 @@ defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
||||
|
||||
test "it creates an update activity with the new actor data" do
|
||||
actor = insert(:actor)
|
||||
actor_data = MobilizonWeb.ActivityPub.ActorView.render("actor.json", %{actor: actor})
|
||||
actor_data = ActorView.render("actor.json", %{actor: actor})
|
||||
actor_data = Map.put(actor_data, "summary", @updated_actor_summary)
|
||||
|
||||
{:ok, update, updated_actor} =
|
||||
@@ -191,7 +194,7 @@ defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
||||
test "it creates an update activity with the new event data" do
|
||||
actor = insert(:actor)
|
||||
event = insert(:event, organizer_actor: actor)
|
||||
event_data = Mobilizon.Service.ActivityPub.Converters.Event.model_to_as(event)
|
||||
event_data = Converter.Event.model_to_as(event)
|
||||
event_data = Map.put(event_data, "startTime", @updated_start_time)
|
||||
|
||||
{:ok, update, updated_event} =
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
defmodule Mobilizon.Service.ActivityPub.Converters.ActorTest do
|
||||
defmodule Mobilizon.Service.ActivityPub.Converter.ActorTest do
|
||||
use Mobilizon.DataCase
|
||||
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Service.ActivityPub.Converters.Actor, as: ActorConverter
|
||||
alias Mobilizon.Service.ActivityPub.Converter.Actor, as: ActorConverter
|
||||
|
||||
describe "actor to AS" do
|
||||
test "valid actor to as" do
|
||||
@@ -18,6 +18,8 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
alias Mobilizon.Service.ActivityPub.{Activity, Utils}
|
||||
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
||||
|
||||
alias MobilizonWeb.API
|
||||
|
||||
setup_all do
|
||||
HTTPoison.start()
|
||||
end
|
||||
@@ -845,7 +847,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
other_actor = insert(:actor)
|
||||
|
||||
{:ok, activity, _} =
|
||||
MobilizonWeb.API.Comments.create_comment(
|
||||
API.Comments.create_comment(
|
||||
actor.preferred_username,
|
||||
"hey, @#{other_actor.preferred_username}, how are ya? #2hu"
|
||||
)
|
||||
@@ -881,8 +883,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
test "it adds the json-ld context and the conversation property" do
|
||||
actor = insert(:actor)
|
||||
|
||||
{:ok, activity, _} =
|
||||
MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "hey")
|
||||
{:ok, activity, _} = API.Comments.create_comment(actor.preferred_username, "hey")
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
@@ -892,8 +893,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
test "it sets the 'attributedTo' property to the actor of the object if it doesn't have one" do
|
||||
actor = insert(:actor)
|
||||
|
||||
{:ok, activity, _} =
|
||||
MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "hey")
|
||||
{:ok, activity, _} = API.Comments.create_comment(actor.preferred_username, "hey")
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
@@ -903,8 +903,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
test "it strips internal hashtag data" do
|
||||
actor = insert(:actor)
|
||||
|
||||
{:ok, activity, _} =
|
||||
MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "#2hu")
|
||||
{:ok, activity, _} = API.Comments.create_comment(actor.preferred_username, "#2hu")
|
||||
|
||||
expected_tag = %{
|
||||
"href" => MobilizonWeb.Endpoint.url() <> "/tags/2hu",
|
||||
@@ -920,8 +919,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
test "it strips internal fields" do
|
||||
actor = insert(:actor)
|
||||
|
||||
{:ok, activity, _} =
|
||||
MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "#2hu")
|
||||
{:ok, activity, _} = API.Comments.create_comment(actor.preferred_username, "#2hu")
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||
|
||||
import Mobilizon.Factory
|
||||
|
||||
alias Mobilizon.Service.ActivityPub.Utils
|
||||
alias Mobilizon.Service.ActivityPub.{Converter, Utils}
|
||||
|
||||
alias MobilizonWeb.Endpoint
|
||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||
@@ -28,7 +28,7 @@ defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||
"id" => Routes.page_url(Endpoint, :comment, reply.uuid),
|
||||
"inReplyTo" => comment.url,
|
||||
"attributedTo" => reply.actor.url
|
||||
} == Mobilizon.Service.ActivityPub.Converters.Comment.model_to_as(reply)
|
||||
} == Converter.Comment.model_to_as(reply)
|
||||
end
|
||||
|
||||
test "comment data from map" do
|
||||
|
||||
Reference in New Issue
Block a user