BBS: Tests and formatting.
[akkoma] / test / bbs / handler_test.exs
1 defmodule Pleroma.BBS.HandlerTest do
2 use Pleroma.DataCase
3 alias Pleroma.BBS.Handler
4 alias Pleroma.Web.CommonAPI
5 alias Pleroma.User
6
7 import ExUnit.CaptureIO
8 import Pleroma.Factory
9
10 test "getting the home timeline" do
11 user = insert(:user)
12 followed = insert(:user)
13
14 {:ok, user} = User.follow(user, followed)
15
16 {:ok, _first} = CommonAPI.post(user, %{"status" => "hey"})
17 {:ok, _second} = CommonAPI.post(followed, %{"status" => "hello"})
18
19 output =
20 capture_io(fn ->
21 Handler.handle_command(%{user: user}, "home")
22 end)
23
24 assert output =~ user.nickname
25 assert output =~ followed.nickname
26
27 assert output =~ "hey"
28 assert output =~ "hello"
29 end
30 end