Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21968737
user_is_admin_plug_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
871 B
Referenced Files
None
Subscribers
None
user_is_admin_plug_test.exs
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.Plugs.UserIsAdminPlugTest
do
use
Pleroma.Web.ConnCase
,
async
:
true
alias
Pleroma.Web.Plugs.UserIsAdminPlug
import
Pleroma.Factory
test
"accepts a user that is an admin"
do
user
=
insert
(
:user
,
is_admin
:
true
)
conn
=
assign
(
build_conn
(),
:user
,
user
)
ret_conn
=
UserIsAdminPlug
.
call
(
conn
,
%{})
assert
conn
==
ret_conn
end
test
"denies a user that isn't an admin"
do
user
=
insert
(
:user
)
conn
=
build_conn
()
|>
assign
(
:user
,
user
)
|>
UserIsAdminPlug
.
call
(%{})
assert
conn
.
status
==
403
end
test
"denies when a user isn't set"
do
conn
=
UserIsAdminPlug
.
call
(
build_conn
(),
%{})
assert
conn
.
status
==
403
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 28, 3:25 AM (8 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
814788
Default Alt Text
user_is_admin_plug_test.exs (871 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment