Floatingghost
ad52135bf5
Some checks are pending
ci/woodpecker/push/build-amd64 Pipeline is pending
ci/woodpecker/push/build-arm64 Pipeline is pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/test Pipeline is pending
ci/woodpecker/pr/build-amd64 Pipeline is pending
ci/woodpecker/pr/build-arm64 Pipeline is pending
ci/woodpecker/pr/docs Pipeline is pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
43 lines
1 KiB
Elixir
43 lines
1 KiB
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.Web.RichMedia.Parser.TTL.OpengraphTest do
|
|
use Pleroma.DataCase
|
|
use Oban.Testing, repo: Pleroma.Repo
|
|
|
|
import Mox
|
|
|
|
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
|
alias Pleroma.Web.RichMedia.Card
|
|
|
|
setup do
|
|
ConfigMock
|
|
|> stub_with(Pleroma.Test.StaticConfig)
|
|
|
|
clear_config([:rich_media, :enabled], true)
|
|
|
|
:ok
|
|
end
|
|
|
|
test "OpenGraph TTL value is honored" do
|
|
url = "https://reddit.com/r/somepost"
|
|
|
|
Tesla.Mock.mock(fn
|
|
%{
|
|
method: :get,
|
|
url: ^url
|
|
} ->
|
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/reddit.html")}
|
|
|
|
%{method: :head} ->
|
|
%Tesla.Env{status: 200}
|
|
end)
|
|
|
|
Card.get_or_backfill_by_url(url)
|
|
# wait for oban
|
|
Pleroma.Tests.ObanHelpers.perform_all()
|
|
|
|
assert_enqueued(worker: Pleroma.Workers.RichMediaExpirationWorker, args: %{"url" => url})
|
|
end
|
|
end
|