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
1b57522b
Commit
1b57522b
authored
Apr 02, 2018
by
lain
Browse files
Fix some test stuff.
parent
4e4a3e5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/gopher/server.ex
View file @
1b57522b
...
...
@@ -51,8 +51,9 @@ def init(ref, socket, transport, _Opts = []) do
def
info
(
text
)
do
text
=
String
.
replace
(
text
,
~r/[\t\n]/
,
""
)
String
.
split
(
text
,
"
\r
"
)
|>
Enum
.
map
(
fn
(
text
)
->
|>
Enum
.
map
(
fn
text
->
"i
#{
text
}
\t
fake\(NULL)
\t
0
\r\n
"
end
)
|>
Enum
.
join
(
""
)
...
...
@@ -82,7 +83,12 @@ def render_activities(activities) do
link
(
"Post #
#{
activity
.
id
}
by
#{
user
.
nickname
}
"
,
"/notices/
#{
activity
.
id
}
"
)
<>
info
(
"
#{
like_count
}
likes,
#{
announcement_count
}
repeats"
)
<>
"
\r\n
"
<>
info
(
HtmlSanitizeEx
.
strip_tags
(
String
.
replace
(
activity
.
data
[
"object"
][
"content"
],
"<br>"
,
"
\r
"
)))
"
\r\n
"
<>
info
(
HtmlSanitizeEx
.
strip_tags
(
String
.
replace
(
activity
.
data
[
"object"
][
"content"
],
"<br>"
,
"
\r
"
)
)
)
end
)
|>
Enum
.
join
(
"
\r\n
"
)
end
...
...
test/web/twitter_api/twitter_api_controller_test.exs
View file @
1b57522b
...
...
@@ -600,8 +600,9 @@ test "it returns a user's followers", %{conn: conn} do
|>
assign
(
:user
,
user
)
|>
get
(
"/api/statuses/followers"
)
assert
json_response
(
conn
,
200
)
==
UserView
.
render
(
"index.json"
,
%{
users:
[
follower_one
,
follower_two
],
for:
user
})
expected
=
UserView
.
render
(
"index.json"
,
%{
users:
[
follower_one
,
follower_two
],
for:
user
})
result
=
json_response
(
conn
,
200
)
assert
Enum
.
sort
(
expected
)
==
Enum
.
sort
(
result
)
end
end
...
...
@@ -620,12 +621,9 @@ test "it returns the logged in user's friends", %{conn: conn} do
|>
assign
(
:user
,
user
)
|>
get
(
"/api/statuses/friends"
)
assert
MapSet
.
equal?
(
MapSet
.
new
(
json_response
(
conn
,
200
)),
MapSet
.
new
(
UserView
.
render
(
"index.json"
,
%{
users:
[
followed_one
,
followed_two
],
for:
user
})
)
)
expected
=
UserView
.
render
(
"index.json"
,
%{
users:
[
followed_one
,
followed_two
],
for:
user
})
result
=
json_response
(
conn
,
200
)
assert
Enum
.
sort
(
expected
)
==
Enum
.
sort
(
result
)
end
test
"it returns a given user's friends with user_id"
,
%{
conn:
conn
}
do
...
...
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