debianize-mobilizon/test/mobilizon/service/activity_pub/converter/actor_test.exs
Thomas Citharel cc820d6b63
Refactor Core things, including Ecto handling, ActivityPub & Transmogrifier modules
* Data doesn't need anymore to be converted to ActivityStream format to
be saved (this was taken from Pleroma and not at all a good idea here)
* Everything saved when creating an event is inserted into PostgreSQL in
a single transaction
2019-10-31 10:06:11 +01:00

29 lines
825 B
Elixir

defmodule Mobilizon.Service.ActivityPub.Converter.ActorTest do
use Mobilizon.DataCase
alias Mobilizon.Actors.Actor
alias Mobilizon.Service.ActivityPub.Converter.Actor, as: ActorConverter
describe "actor to AS" do
test "valid actor to as" do
data = ActorConverter.model_to_as(%Actor{type: :Person, preferred_username: "test_account"})
assert is_map(data)
assert data["type"] == "Person"
assert data["preferred_username"] == "test_account"
end
end
describe "AS to Actor" do
test "valid as data to model" do
{:ok, actor} =
ActorConverter.as_to_model_data(%{
"type" => "Person",
"preferredUsername" => "test_account"
})
assert actor["type"] == :Person
assert actor["preferred_username"] == "test_account"
end
end
end