Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33101576
only_media_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
817 B
Referenced Files
None
Subscribers
None
only_media_test.exs
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Upload.Filter.OnlyMediaTest
do
use
Pleroma.DataCase
,
async
:
true
alias
Pleroma.Upload
alias
Pleroma.Upload.Filter.OnlyMedia
test
"Allows media Content-Type"
do
[
"audio/mpeg"
,
"image/jpeg"
,
"video/mp4"
]
|>
Enum
.
each
(
fn
type
->
upload
=
%
Upload
{
content_type
:
type
}
assert
{
:ok
,
:noop
}
=
OnlyMedia
.
filter
(
upload
)
end
)
end
test
"Disallows non-media Content-Type"
do
[
"application/javascript"
,
"application/pdf"
,
"text/html"
]
|>
Enum
.
each
(
fn
type
->
upload
=
%
Upload
{
content_type
:
type
}
assert
{
:error
,
_
}
=
OnlyMedia
.
filter
(
upload
)
end
)
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 12:30 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
963994
Default Alt Text
only_media_test.exs (817 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment