diff options
author | lain <lain@soykaf.club> | 2019-04-10 09:34:53 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-04-10 15:01:42 +0200 |
commit | d1da6b155ab758ae4eb8fa154997a0a2a179897c (patch) | |
tree | 3a52029fa49619db4dff6db41933d623f07d0bae /test | |
parent | b5cecebbc14c80d08f1a9f541722218c48dc514f (diff) | |
download | pleroma-d1da6b155ab758ae4eb8fa154997a0a2a179897c.tar.gz |
Conversation: Add Conversations and Participations.
Diffstat (limited to 'test')
-rw-r--r-- | test/conversation/participation_test.exs | 22 | ||||
-rw-r--r-- | test/conversation_test.exs | 12 | ||||
-rw-r--r-- | test/support/factory.ex | 6 |
3 files changed, 40 insertions, 0 deletions
diff --git a/test/conversation/participation_test.exs b/test/conversation/participation_test.exs new file mode 100644 index 000000000..8dc15a802 --- /dev/null +++ b/test/conversation/participation_test.exs @@ -0,0 +1,22 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Conversation.ParticipationTest do + use Pleroma.DataCase + + import Pleroma.Factory + + alias Pleroma.Conversation.Participation + + test "it creates a participation for a conversation and a user" do + user = insert(:user) + conversation = insert(:conversation) + + {:ok, %Participation{} = participation} = + Participation.create_for_user_and_conversation(user, conversation) + + assert participation.user_id == user.id + assert participation.conversation_id == conversation.id + end +end diff --git a/test/conversation_test.exs b/test/conversation_test.exs new file mode 100644 index 000000000..8fb55d51c --- /dev/null +++ b/test/conversation_test.exs @@ -0,0 +1,12 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.ConversationTest do + use Pleroma.DataCase + alias Pleroma.Conversation + + test "it creates a conversation for given ap_id" do + assert {:ok, %Conversation{}} = Conversation.create_for_ap_id("https://some_ap_id") + end +end diff --git a/test/support/factory.ex b/test/support/factory.ex index ea59912cf..af38be46c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -5,6 +5,12 @@ defmodule Pleroma.Factory do use ExMachina.Ecto, repo: Pleroma.Repo + def conversation_factory do + %Pleroma.Conversation{ + ap_id: sequence(:ap_id, &"https://some_conversation/#{&1}") + } + end + def user_factory do user = %Pleroma.User{ name: sequence(:name, &"Test テスト User #{&1}"), |