Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mfc
pleroma
Commits
c22f0bfb
Commit
c22f0bfb
authored
5 years ago
by
kaniini
Browse files
Options
Downloads
Patches
Plain Diff
test: add tests for mediaproxy warming policy
parent
074ffee0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs
+45
-0
45 additions, 0 deletions
test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs
with
45 additions
and
0 deletions
test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs
0 → 100644
+
45
−
0
View file @
c22f0bfb
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma
.
Web
.
ActivityPub
.
MRF
.
MediaProxyWarmingPolicyTest
do
use
Pleroma
.
DataCase
alias
Pleroma
.
HTTP
alias
Pleroma
.
Web
.
ActivityPub
.
MRF
.
MediaProxyWarmingPolicy
import
Mock
@message
%{
"type"
=>
"Create"
,
"object"
=>
%{
"type"
=>
"Note"
,
"content"
=>
"content"
,
"attachment"
=>
[
%{
"url"
=>
[%{
"href"
=>
"http://example.com/image.jpg"
}]}
]
}
}
test
"it prefetches media proxy URIs"
do
with_mock
HTTP
,
get:
fn
_
,
_
,
_
->
{
:ok
,
[]}
end
do
MediaProxyWarmingPolicy
.
filter
(
@message
)
assert
called
(
HTTP
.
get
(
:_
,
:_
,
:_
))
end
end
test
"it does nothing when no attachments are present"
do
object
=
@message
[
"object"
]
|>
Map
.
delete
(
"attachment"
)
message
=
@message
|>
Map
.
put
(
"object"
,
object
)
with_mock
HTTP
,
get:
fn
_
,
_
,
_
->
{
:ok
,
[]}
end
do
MediaProxyWarmingPolicy
.
filter
(
message
)
refute
called
(
HTTP
.
get
(
:_
,
:_
,
:_
))
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment