update test
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
6655b1ee38
commit
9d40689e47
4 changed files with 6 additions and 88 deletions
33
.github/workflows/pl.yaml
vendored
33
.github/workflows/pl.yaml
vendored
|
@ -1,4 +1,6 @@
|
|||
name: PL CI
|
||||
# Adapter from https://fly.io/phoenix-files/github-actions-for-elixir-ci/
|
||||
|
||||
name: pl CI
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -9,21 +11,13 @@ on:
|
|||
env:
|
||||
ELIXIR_VER: 1.15.8
|
||||
POSTGRES_DB: pleroma_test
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
MIX_ENV: test
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
|
||||
jobs:
|
||||
test:
|
||||
# Set up a Postgres DB service. By default, Phoenix applications
|
||||
# use Postgres. This creates a database for running tests.
|
||||
# Additional services can be defined here if required.
|
||||
services:
|
||||
db:
|
||||
image: postgres:12
|
||||
|
@ -41,28 +35,22 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
||||
strategy:
|
||||
# Specify the OTP and Elixir versions to use when building
|
||||
# and running the workflow steps.
|
||||
matrix:
|
||||
otp: ['25.0.4'] # Define the OTP version [required]
|
||||
elixir: ['1.15.8'] # Define the elixir version [required]
|
||||
otp: ['26.2.5']
|
||||
elixir: ['1.15.8']
|
||||
steps:
|
||||
# Step: Install system dependencies
|
||||
- name: Install system dependencies
|
||||
run: sudo apt install -y imagemagick ffmpeg libimage-exiftool-perl
|
||||
|
||||
# Step: Setup Elixir + Erlang image as the base.
|
||||
- name: Set up Elixir
|
||||
uses: erlef/setup-beam@v1
|
||||
with:
|
||||
otp-version: ${{matrix.otp}}
|
||||
elixir-version: ${{matrix.elixir}}
|
||||
|
||||
# Step: Check out the code.
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Step: Define how to cache deps. Restores existing cache if present.
|
||||
- name: Cache deps
|
||||
id: cache-deps
|
||||
uses: actions/cache@v3
|
||||
|
@ -74,9 +62,6 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-mix-${{ env.cache-name }}-
|
||||
|
||||
# Step: Define how to cache the `_build` directory. After the first run,
|
||||
# this speeds up tests runs a lot. This includes not re-compiling our
|
||||
# project's downloaded deps every run.
|
||||
- name: Cache compiled build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
|
@ -89,23 +74,15 @@ jobs:
|
|||
${{ runner.os }}-mix-${{ env.cache-name }}-
|
||||
${{ runner.os }}-mix-
|
||||
|
||||
# Step: Download project dependencies. If unchanged, uses
|
||||
# the cached version.
|
||||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
# Step: Compile the project treating any warnings as errors.
|
||||
# Customize this step if a different behavior is desired.
|
||||
- name: Compiles without warnings
|
||||
run: mix compile --warnings-as-errors
|
||||
|
||||
# Step: Check that the checked in code has already been formatted.
|
||||
# This step fails if something was found unformatted.
|
||||
# Customize this step as desired.
|
||||
- name: Check Formatting
|
||||
run: mix format --check-formatted
|
||||
|
||||
# Step: Execute the tests.
|
||||
- name: Run tests
|
||||
run: |
|
||||
mix ecto.create
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
defmodule Pleroma.Repo.Migrations.RenameInstanceChat do
|
||||
use Ecto.Migration
|
||||
|
||||
alias Pleroma.ConfigDB
|
||||
|
||||
def up, do: :noop
|
||||
def down, do: :noop
|
||||
end
|
||||
|
|
|
@ -182,7 +182,7 @@ test "it strips voters list and displays voters count instead" do
|
|||
})
|
||||
|
||||
object = Object.normalize(activity, fetch: false)
|
||||
{:ok, _, _} = CommonAPI.vote(other_user, object, [1])
|
||||
{:ok, _, _} = CommonAPI.vote(object, other_user, [1])
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.WebhookTest do
|
||||
use Pleroma.DataCase, async: true
|
||||
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Webhook
|
||||
|
||||
test "creating a webhook" do
|
||||
%{id: id} = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]})
|
||||
|
||||
assert %{url: "https://example.com/webhook"} = Webhook.get(id)
|
||||
end
|
||||
|
||||
test "editing a webhook" do
|
||||
%{id: id} =
|
||||
webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]})
|
||||
|
||||
Webhook.update(webhook, %{events: [:"account.created"]})
|
||||
|
||||
assert %{events: [:"account.created"]} = Webhook.get(id)
|
||||
end
|
||||
|
||||
test "filter webhooks by type" do
|
||||
%{id: id1} =
|
||||
Webhook.create(%{url: "https://example.com/webhook1", events: [:"report.created"]})
|
||||
|
||||
%{id: id2} =
|
||||
Webhook.create(%{
|
||||
url: "https://example.com/webhook2",
|
||||
events: [:"account.created", :"report.created"]
|
||||
})
|
||||
|
||||
Webhook.create(%{url: "https://example.com/webhook3", events: [:"account.created"]})
|
||||
|
||||
assert [%{id: ^id1}, %{id: ^id2}] = Webhook.get_by_type(:"report.created")
|
||||
end
|
||||
|
||||
test "change webhook state" do
|
||||
%{id: id, enabled: true} =
|
||||
webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]})
|
||||
|
||||
Webhook.set_enabled(webhook, false)
|
||||
assert %{enabled: false} = Webhook.get(id)
|
||||
end
|
||||
|
||||
test "rotate webhook secrets" do
|
||||
%{id: id, secret: secret} =
|
||||
webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]})
|
||||
|
||||
Webhook.rotate_secret(webhook)
|
||||
%{secret: new_secret} = Webhook.get(id)
|
||||
assert secret != new_secret
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue