mirror of
https://github.com/plausible/analytics.git
synced 2024-12-28 12:01:39 +03:00
c96f364ad8
* Add and remove recipients for email reports * Remove unused google_settings controller action * Background job sends email reports to multiple recipients * Add a way to unsubscribe for recipients who cannot log in * Fix view on plausible link * Include bounce rate in email report
33 lines
1.2 KiB
Elixir
33 lines
1.2 KiB
Elixir
defmodule PlausibleWeb.UnsubscribeControllerTest do
|
|
use PlausibleWeb.ConnCase
|
|
use Plausible.Repo
|
|
|
|
describe "GET /sites/:website/weekly-report/unsubscribe" do
|
|
test "removes a recipient from the weekly report without them having to log in", %{conn: conn} do
|
|
site = insert(:site)
|
|
insert(:weekly_report, site: site, recipients: ["recipient@email.com"])
|
|
|
|
conn = get(conn, "/sites/#{site.domain}/weekly-report/unsubscribe?email=recipient@email.com")
|
|
|
|
assert html_response(conn, 200) =~ "Unsubscribe successful"
|
|
|
|
report = Repo.get_by(Plausible.Site.WeeklyReport, site_id: site.id)
|
|
assert report.recipients == []
|
|
end
|
|
end
|
|
|
|
describe "GET /sites/:website/monthly-report/unsubscribe" do
|
|
test "removes a recipient from the weekly report without them having to log in", %{conn: conn} do
|
|
site = insert(:site)
|
|
insert(:monthly_report, site: site, recipients: ["recipient@email.com"])
|
|
|
|
conn = get(conn, "/sites/#{site.domain}/monthly-report/unsubscribe?email=recipient@email.com")
|
|
|
|
assert html_response(conn, 200) =~ "Unsubscribe successful"
|
|
|
|
report = Repo.get_by(Plausible.Site.MonthlyReport, site_id: site.id)
|
|
assert report.recipients == []
|
|
end
|
|
end
|
|
end
|