Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33101618
web_push_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
858 B
Referenced Files
None
Subscribers
None
web_push_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.HTTP.WebPushTest
do
use
ExUnit.Case
import
Tesla.Mock
alias
Pleroma.HTTP
@push_url
"https://some-push-server/"
setup
do
mock
(
fn
%{
method
:
:post
,
url
:
@push_url
,
headers
:
headers
}
->
if
{
"content-type"
,
"octet-stream"
}
in
headers
do
%
Tesla.Env
{
status
:
200
}
else
%
Tesla.Env
{
status
:
403
}
end
end
)
:ok
end
test
"post"
do
response
=
HTTP.WebPush
.
post
(
@push_url
,
"encrypted payload"
,
%{
"authorization"
=>
"WebPush"
},
[]
)
assert
{
:ok
,
%{
status
:
200
}}
=
response
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 12:40 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
913433
Default Alt Text
web_push_test.exs (858 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment