Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F12552654
translation_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
774 B
Referenced Files
None
Subscribers
None
translation_test.exs
View Options
defmodule
Pleroma.Language.TranslationTest
do
use
Pleroma.Web.ConnCase
alias
Pleroma.Language.Translation
setup
do
:
clear_config
([
Pleroma.Language.Translation
,
:provider
],
TranslationMock
)
test
"it translates text"
do
assert
{
:ok
,
%{
content
:
"txet emos"
,
detected_source_language
:
_
,
provider
:
_
}}
=
Translation
.
translate
(
"some text"
,
"en"
,
"uk"
)
end
test
"it stores translation result in cache"
do
Translation
.
translate
(
"some text"
,
"en"
,
"uk"
)
assert
{
:ok
,
result
}
=
Cachex
.
get
(
:translations_cache
,
"en/uk/
#{
:crypto
.
hash
(
:sha256
,
"some text"
)
|>
Base
.
encode64
()
}
"
)
assert
result
.
content
==
"txet emos"
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 15, 12:54 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
632982
Default Alt Text
translation_test.exs (774 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment