defmodule VigilWeb.AssetlinksTest do
@moduledoc """
/.well-known/assetlinks.json (NeiamAuth.App.AssetLinksPlug): which
Android app may open this site's emailed sign-in links as App Links.
"""
use VigilWeb.ConnCase, async: false
@fp Enum.map_join(1..32, ":", fn _ -> "AB" end)
setup do
old = Application.get_env(:neiam_auth, :app)
on_exit(fn -> Application.put_env(:neiam_auth, :app, old) end)
%{old: old}
end
test "vouches for the app's package and signing certs", %{conn: conn, old: old} do
Application.put_env(:neiam_auth, :app, Keyword.put(old, :android_cert_fingerprints, @fp))
conn = get(conn, "/.well-known/assetlinks.json")
assert [statement] = json_response(conn, 200)
assert statement["relation"] == ["delegate_permission/common.handle_all_urls"]
assert statement["target"] == %{
"namespace" => "android_app",
"package_name" => "org.neiam.vigil.app",
"sha256_cert_fingerprints" => [@fp]
}
end
test "without ANDROID_CERT_FINGERPRINTS it claims nothing (links open in the browser)",
%{conn: conn} do
System.delete_env("ANDROID_CERT_FINGERPRINTS")
assert json_response(get(conn, "/.well-known/assetlinks.json"), 200) == []
end
end
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
1.2 KiB · text
History
3208487