Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33102373
mogrify_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
mogrify_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.Upload.Filter.MogrifyTest
do
use
Pleroma.DataCase
import
Mock
alias
Pleroma.Upload.Filter
test
"apply mogrify filter"
do
clear_config
(
Filter.Mogrify
,
args
:
[{
"tint"
,
"40"
}])
File
.
cp!
(
"test/fixtures/image.jpg"
,
"test/fixtures/image_tmp.jpg"
)
upload
=
%
Pleroma.Upload
{
name
:
"an… image.jpg"
,
content_type
:
"image/jpeg"
,
path
:
Path
.
absname
(
"test/fixtures/image_tmp.jpg"
),
tempfile
:
Path
.
absname
(
"test/fixtures/image_tmp.jpg"
)
}
task
=
Task
.
async
(
fn
->
assert_receive
{
:apply_filter
,
{
_
,
"tint"
,
"40"
}},
4_000
end
)
with_mock
Mogrify
,
open
:
fn
_f
->
%
Mogrify.Image
{}
end
,
custom
:
fn
_m
,
_a
->
:ok
end
,
custom
:
fn
m
,
a
,
o
->
send
(
task
.
pid
,
{
:apply_filter
,
{
m
,
a
,
o
}})
end
,
save
:
fn
_f
,
_o
->
:ok
end
do
assert
Filter.Mogrify
.
filter
(
upload
)
==
{
:ok
,
:filtered
}
end
Task
.
await
(
task
)
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 1:07 PM (1 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
961082
Default Alt Text
mogrify_test.exs (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment