Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33103739
scheduled_activity_worker_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
scheduled_activity_worker_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.Workers.ScheduledActivityWorkerTest
do
use
Pleroma.DataCase
alias
Pleroma.ScheduledActivity
alias
Pleroma.Workers.ScheduledActivityWorker
import
Pleroma.Factory
import
ExUnit.CaptureLog
setup
do
:
clear_config
([
ScheduledActivity
,
:enabled
],
true
)
test
"creates a status from the scheduled activity"
do
user
=
insert
(
:user
)
naive_datetime
=
NaiveDateTime
.
add
(
NaiveDateTime
.
utc_now
(),
-
:timer
.
minutes
(
2
),
:millisecond
)
scheduled_activity
=
insert
(
:scheduled_activity
,
scheduled_at
:
naive_datetime
,
user
:
user
,
params
:
%{
status
:
"hi"
}
)
{
:ok
,
%{
id
:
activity_id
}}
=
ScheduledActivityWorker
.
perform
(%
Oban.Job
{
args
:
%{
"activity_id"
=>
scheduled_activity
.
id
}})
refute
Repo
.
get
(
ScheduledActivity
,
scheduled_activity
.
id
)
object
=
Pleroma.Activity
|>
Repo
.
get
(
activity_id
)
|>
Pleroma.Object
.
normalize
()
assert
object
.
data
[
"content"
]
==
"hi"
end
test
"error message for non-existent scheduled activity"
do
assert
capture_log
([
level
:
:error
],
fn
->
ScheduledActivityWorker
.
perform
(%
Oban.Job
{
args
:
%{
"activity_id"
=>
42
}})
end
)
=~
"Couldn't find scheduled activity: 42"
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 2:01 PM (10 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
972533
Default Alt Text
scheduled_activity_worker_test.exs (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment