1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.MongooseIMControllerTest do
6 use Pleroma.Web.ConnCase, async: true
9 test "/user_exists", %{conn: conn} do
10 _user = insert(:user, nickname: "lain")
11 _remote_user = insert(:user, nickname: "alice", local: false)
12 _deactivated_user = insert(:user, nickname: "konata", is_active: false)
16 |> get(mongoose_im_path(conn, :user_exists), user: "lain")
23 |> get(mongoose_im_path(conn, :user_exists), user: "alice")
30 |> get(mongoose_im_path(conn, :user_exists), user: "bob")
37 |> get(mongoose_im_path(conn, :user_exists), user: "konata")
43 test "/check_password", %{conn: conn} do
44 user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("cool"))
50 password_hash: Pleroma.Password.hash_pwd_salt("cool")
55 |> get(mongoose_im_path(conn, :check_password), user: user.nickname, pass: "cool")
62 |> get(mongoose_im_path(conn, :check_password), user: user.nickname, pass: "uncool")
69 |> get(mongoose_im_path(conn, :check_password), user: "konata", pass: "cool")
76 |> get(mongoose_im_path(conn, :check_password), user: "nobody", pass: "cool")