debianize-mobilizon/test/mobilizon/service/activity_pub/converters/actor_test.exs
Thomas Citharel f90089e1bf
Refactor media upload
Use Upload Media logic from Pleroma

Backend changes for picture upload

Move AS <-> Model conversion to separate module

Front changes

Downgrade apollo-client: https://github.com/Akryum/vue-apollo/issues/577

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-05-24 17:29:51 +02:00

28 lines
820 B
Elixir

defmodule Mobilizon.Service.ActivityPub.Converters.ActorTest do
use Mobilizon.DataCase
alias Mobilizon.Service.ActivityPub.Converters.Actor, as: ActorConverter
alias Mobilizon.Actors.Actor
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
actor =
ActorConverter.as_to_model_data(%{
"type" => "Person",
"preferred_username" => "test_account"
})
assert actor["type"] == :Person
assert actor["preferred_username"] == "test_account"
end
end
end