mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-30 09:02:28 +00:00
98cb255d12
OTP builds to 1.15
Changelog entry
Ensure policies are fully loaded
Fix :warn
use main branch for linkify
Fix warn in tests
Migrations for phoenix 1.17
Revert "Migrations for phoenix 1.17"
This reverts commit 6a3b2f15b7
.
Oban upgrade
Add default empty whitelist
mix format
limit test to amd64
OTP 26 tests for 1.15
use OTP_VERSION tag
baka
just 1.15
Massive deps update
Update locale, deps
Mix format
shell????
multiline???
?
max cases 1
use assert_recieve
don't put_env in async tests
don't async conn/fs tests
mix format
FIx some uploader issues
Fix tests
82 lines
2 KiB
Elixir
82 lines
2 KiB
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.Web.MongooseIMControllerTest do
|
|
use Pleroma.Web.ConnCase, async: false
|
|
import Pleroma.Factory
|
|
|
|
test "/user_exists", %{conn: conn} do
|
|
_user = insert(:user, nickname: "lain")
|
|
_remote_user = insert(:user, nickname: "alice", local: false)
|
|
_deactivated_user = insert(:user, nickname: "konata", is_active: false)
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :user_exists), user: "lain")
|
|
|> json_response(200)
|
|
|
|
assert res == true
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :user_exists), user: "alice")
|
|
|> json_response(404)
|
|
|
|
assert res == false
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :user_exists), user: "bob")
|
|
|> json_response(404)
|
|
|
|
assert res == false
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :user_exists), user: "konata")
|
|
|> json_response(404)
|
|
|
|
assert res == false
|
|
end
|
|
|
|
test "/check_password", %{conn: conn} do
|
|
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("cool"))
|
|
|
|
_deactivated_user =
|
|
insert(:user,
|
|
nickname: "konata",
|
|
is_active: false,
|
|
password_hash: Pleroma.Password.hash_pwd_salt("cool")
|
|
)
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :check_password), user: user.nickname, pass: "cool")
|
|
|> json_response(200)
|
|
|
|
assert res == true
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :check_password), user: user.nickname, pass: "uncool")
|
|
|> json_response(403)
|
|
|
|
assert res == false
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :check_password), user: "konata", pass: "cool")
|
|
|> json_response(404)
|
|
|
|
assert res == false
|
|
|
|
res =
|
|
conn
|
|
|> get(mongoose_im_path(conn, :check_password), user: "nobody", pass: "cool")
|
|
|> json_response(404)
|
|
|
|
assert res == false
|
|
end
|
|
end
|