Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/config/test.exs b/config/test.exs
index f5348bd46..5670e11a0 100644
--- a/config/test.exs
+++ b/config/test.exs
@@ -1,50 +1,51 @@
use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :pleroma, Pleroma.Web.Endpoint,
http: [port: 4001],
server: false
# Disable captha for tests
config :pleroma, Pleroma.Captcha,
enabled: true,
- method: Pleroma.Captcha.Mock # A fake captcha service for tests
+ # A fake captcha service for tests
+ method: Pleroma.Captcha.Mock
# Print only warnings and errors during test
config :logger, level: :warn
config :pleroma, Pleroma.Uploaders.Local, uploads: "test/uploads"
config :pleroma, Pleroma.Mailer, adapter: Swoosh.Adapters.Test
# Configure your database
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "pleroma_test",
hostname: System.get_env("DB_HOST") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox
# Reduce hash rounds for testing
config :pbkdf2_elixir, rounds: 1
config :pleroma, :websub, Pleroma.Web.WebsubMock
config :pleroma, :ostatus, Pleroma.Web.OStatusMock
config :tesla, adapter: Tesla.Mock
config :web_push_encryption, :vapid_details,
subject: "mailto:administrator@example.com",
public_key:
"BLH1qVhJItRGCfxgTtONfsOKDc9VRAraXw-3NsmjMngWSh7NxOizN6bkuRA7iLTMPS82PjwJAr3UoK9EC1IFrz4",
private_key: "_-XZ0iebPrRfZ_o0-IatTdszYa8VCH1yLN-JauK7HHA"
try do
import_config "test.secret.exs"
rescue
_ ->
IO.puts(
"You may want to create test.secret.exs to declare custom database connection parameters."
)
end
diff --git a/test/captcha_test.ex b/test/captcha_test.ex
index 3942cb051..98e8da79b 100644
--- a/test/captcha_test.ex
+++ b/test/captcha_test.ex
@@ -1,41 +1,38 @@
defmodule Pleroma.CaptchaTest do
use ExUnit.Case
import Tesla.Mock
@ets_options [:ordered_set, :private, :named_table, {:read_concurrency, true}]
describe "Kocaptcha" do
-
setup do
ets_name = Pleroma.Captcha.Kocaptcha.Ets
^ets_name = :ets.new(ets_name, @ets_options)
- mock fn
+ mock(fn
%{method: :get, url: "http://localhost:9093/new"} ->
- json(
- %{
- md5: "63615261b77f5354fb8c4e4986477555",
- token: "afa1815e14e29355e6c8f6b143a39fa2",
- url: "/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
- }
- )
- end
+ json(%{
+ md5: "63615261b77f5354fb8c4e4986477555",
+ token: "afa1815e14e29355e6c8f6b143a39fa2",
+ url: "/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
+ })
+ end)
:ok
end
test "new and validate" do
assert Pleroma.Captcha.Kocaptcha.new() == %{
- type: :kocaptcha,
- token: "afa1815e14e29355e6c8f6b143a39fa2",
- url: "http://localhost:9093/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
- }
+ type: :kocaptcha,
+ token: "afa1815e14e29355e6c8f6b143a39fa2",
+ url: "http://localhost:9093/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
+ }
assert Pleroma.Captcha.Kocaptcha.validate(
- "afa1815e14e29355e6c8f6b143a39fa2",
- "7oEy8c"
- )
+ "afa1815e14e29355e6c8f6b143a39fa2",
+ "7oEy8c"
+ )
end
end
end

File Metadata

Mime Type
text/x-diff
Expires
Fri, Oct 30, 9:44 PM (15 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1800580
Default Alt Text
(3 KB)

Event Timeline