pleroma/test/bbs/handler_test.exs

31 lines
709 B
Elixir
Raw Normal View History

2019-03-31 18:35:10 +00:00
defmodule Pleroma.BBS.HandlerTest do
use Pleroma.DataCase
alias Pleroma.BBS.Handler
alias Pleroma.Web.CommonAPI
alias Pleroma.User
import ExUnit.CaptureIO
import Pleroma.Factory
test "getting the home timeline" do
user = insert(:user)
followed = insert(:user)
{:ok, user} = User.follow(user, followed)
{:ok, _first} = CommonAPI.post(user, %{"status" => "hey"})
{:ok, _second} = CommonAPI.post(followed, %{"status" => "hello"})
output =
capture_io(fn ->
Handler.handle_command(%{user: user}, "home")
end)
assert output =~ user.nickname
assert output =~ followed.nickname
assert output =~ "hey"
assert output =~ "hello"
end
end