Delete test/support/plugins_api_case.ex with huggingface_hub
Browse files
test/support/plugins_api_case.ex
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
defmodule PlausibleWeb.PluginsAPICase do
|
| 2 |
-
@moduledoc """
|
| 3 |
-
This module defines the test case to be used by
|
| 4 |
-
tests that require setting up a Plugins API connection.
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
use ExUnit.CaseTemplate
|
| 8 |
-
|
| 9 |
-
using do
|
| 10 |
-
quote do
|
| 11 |
-
@endpoint PlausibleWeb.Endpoint
|
| 12 |
-
|
| 13 |
-
use Plausible.TestUtils
|
| 14 |
-
use Plausible.Teams.Test
|
| 15 |
-
use Plausible
|
| 16 |
-
|
| 17 |
-
import Plug.Conn
|
| 18 |
-
import Phoenix.ConnTest
|
| 19 |
-
import PlausibleWeb.Plugins.API.Spec, only: [spec: 0]
|
| 20 |
-
import Plausible.Factory
|
| 21 |
-
|
| 22 |
-
import OpenApiSpex.TestAssertions
|
| 23 |
-
|
| 24 |
-
alias PlausibleWeb.Router.Helpers, as: Routes
|
| 25 |
-
alias PlausibleWeb.Plugins.API.Schemas
|
| 26 |
-
|
| 27 |
-
def authenticate(conn, domain, raw_token) do
|
| 28 |
-
conn
|
| 29 |
-
|> Plug.Conn.put_req_header(
|
| 30 |
-
"authorization",
|
| 31 |
-
Plug.BasicAuth.encode_basic_auth(domain, raw_token)
|
| 32 |
-
)
|
| 33 |
-
end
|
| 34 |
-
end
|
| 35 |
-
end
|
| 36 |
-
|
| 37 |
-
setup %{test: test} = tags do
|
| 38 |
-
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Plausible.Repo)
|
| 39 |
-
|
| 40 |
-
unless tags[:async] do
|
| 41 |
-
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, {:shared, self()})
|
| 42 |
-
end
|
| 43 |
-
|
| 44 |
-
Plausible.Test.Support.Sandbox.allow_salts_process()
|
| 45 |
-
|
| 46 |
-
conn = Phoenix.ConnTest.build_conn()
|
| 47 |
-
|
| 48 |
-
site = Plausible.Teams.Test.new_site()
|
| 49 |
-
{:ok, _token, raw_token} = Plausible.Plugins.API.Tokens.create(site, Atom.to_string(test))
|
| 50 |
-
|
| 51 |
-
{:ok, conn: conn, site: site, token: raw_token}
|
| 52 |
-
end
|
| 53 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|