Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
d3b01678
Commit
d3b01678
authored
Feb 25, 2018
by
lain
Browse files
Fix salmon tests.
parent
4d13cc0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
d3b01678
...
@@ -410,8 +410,15 @@ def get_or_fetch_by_ap_id(ap_id) do
...
@@ -410,8 +410,15 @@ def get_or_fetch_by_ap_id(ap_id) do
if
user
=
get_by_ap_id
(
ap_id
)
do
if
user
=
get_by_ap_id
(
ap_id
)
do
user
user
else
else
with
{
:ok
,
user
}
<-
ActivityPub
.
make_user_from_ap_id
(
ap_id
)
do
ap_try
=
ActivityPub
.
make_user_from_ap_id
(
ap_id
)
user
case
ap_try
do
{
:ok
,
user
}
->
user
_
->
case
OStatus
.
make_user
(
ap_id
)
do
{
:ok
,
user
}
->
user
_
->
{
:error
,
"Could not fetch by ap id"
}
end
end
end
end
end
end
end
...
...
test/web/salmon/salmon_test.exs
View file @
d3b01678
...
@@ -59,7 +59,6 @@ test "encodes an xml payload with a private key" do
...
@@ -59,7 +59,6 @@ test "encodes an xml payload with a private key" do
end
end
test
"it gets a magic key"
do
test
"it gets a magic key"
do
# TODO: Make test local
salmon
=
File
.
read!
(
"test/fixtures/salmon2.xml"
)
salmon
=
File
.
read!
(
"test/fixtures/salmon2.xml"
)
{
:ok
,
key
}
=
Salmon
.
fetch_magic_key
(
salmon
)
{
:ok
,
key
}
=
Salmon
.
fetch_magic_key
(
salmon
)
...
@@ -86,7 +85,7 @@ test "it pushes an activity to remote accounts it's addressed to" do
...
@@ -86,7 +85,7 @@ test "it pushes an activity to remote accounts it's addressed to" do
"context"
=>
note
.
data
[
"context"
]
"context"
=>
note
.
data
[
"context"
]
}
}
{
:ok
,
activity
}
=
Repo
.
insert
(%
Activity
{
data:
activity_data
})
{
:ok
,
activity
}
=
Repo
.
insert
(%
Activity
{
data:
activity_data
,
recipients:
activity_data
[
"to"
]
})
user
=
Repo
.
get_by
(
User
,
ap_id:
activity
.
data
[
"actor"
])
user
=
Repo
.
get_by
(
User
,
ap_id:
activity
.
data
[
"actor"
])
{
:ok
,
user
}
=
Pleroma
.
Web
.
WebFinger
.
ensure_keys_present
(
user
)
{
:ok
,
user
}
=
Pleroma
.
Web
.
WebFinger
.
ensure_keys_present
(
user
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment