[Enhancement] Add Apprise support (#170)
* [WIP] add settings sidebar entry and placeholder page * [WIP] added placeholder UI and logic for settings form * Added column and UI for apprise server * Add some tests * Added placeholder command runner for apprise * [WIP] Adding apprise package * Added apprise command runner * Hooked up apprise notification module * Ensured apprise was running in verbose mode * Updated wording of apprise notification * Added apprise to README
This commit is contained in:
@@ -4,6 +4,7 @@ defmodule Pinchflat.FastIndexing.FastIndexingWorkerTest do
|
||||
import Mox
|
||||
import Pinchflat.SourcesFixtures
|
||||
|
||||
alias Pinchflat.Settings
|
||||
alias Pinchflat.Sources.Source
|
||||
alias Pinchflat.FastIndexing.FastIndexingWorker
|
||||
|
||||
@@ -74,4 +75,28 @@ defmodule Pinchflat.FastIndexing.FastIndexingWorkerTest do
|
||||
assert :ok = perform_job(FastIndexingWorker, %{id: 0})
|
||||
end
|
||||
end
|
||||
|
||||
describe "perform/1 when testing notifications" do
|
||||
setup do
|
||||
Settings.set(apprise_server: "server_1")
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
test "sends a notification if new media was found" do
|
||||
source = source_fixture(fast_index: true)
|
||||
|
||||
expect(HTTPClientMock, :get, fn _url -> {:ok, "<yt:videoId>test_1</yt:videoId>"} end)
|
||||
|
||||
expect(AppriseRunnerMock, :run, fn servers, opts ->
|
||||
assert "server_1" = servers
|
||||
assert is_binary(Keyword.get(opts, :title))
|
||||
assert is_binary(Keyword.get(opts, :body))
|
||||
|
||||
{:ok, ""}
|
||||
end)
|
||||
|
||||
perform_job(FastIndexingWorker, %{id: source.id})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user