Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F8613658
helpers.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
765 B
Referenced Files
None
Subscribers
None
helpers.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Tests.Helpers
do
@moduledoc
"""
Helpers for use in tests.
"""
defmacro
__using__
(
_opts
)
do
quote
do
def
refresh_record
(%{
id
:
id
,
__struct__
:
model
}
=
_
),
do
:
refresh_record
(
model
,
%{
id
:
id
})
def
refresh_record
(
model
,
%{
id
:
id
}
=
_
)
do
Pleroma.Repo
.
get_by
(
model
,
id
:
id
)
end
# Used for comparing json rendering during tests.
def
render_json
(
view
,
template
,
assigns
)
do
assigns
=
Map
.
new
(
assigns
)
view
.
render
(
template
,
assigns
)
|>
Poison
.
encode!
()
|>
Poison
.
decode!
()
end
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Oct 25, 6:07 PM (7 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
542441
Default Alt Text
helpers.ex (765 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment