Rename to allowlist
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
defmodule BasicSignupWhitelistTest do
|
||||
defmodule BasicSignupAllowlistTest do
|
||||
use ExUnit.Case, async: false
|
||||
doctest BasicSignupWhitelist
|
||||
doctest BasicSignupAllowlist
|
||||
|
||||
defp allow_signups_for(whitelist) do
|
||||
System.put_env("SIGNUP_ALLOWLIST_EMAILS", whitelist)
|
||||
defp allow_signups_for(allowlist) do
|
||||
System.put_env("SIGNUP_ALLOWLIST_EMAILS", allowlist)
|
||||
end
|
||||
|
||||
describe "setup in describe block" do
|
||||
@@ -16,14 +16,14 @@ defmodule BasicSignupWhitelistTest do
|
||||
:ok
|
||||
end
|
||||
|
||||
test "When not set, not whitelisted" do
|
||||
test "When not set, not allowlisted" do
|
||||
System.delete_env("SIGNUP_ALLOWLIST_EMAILS")
|
||||
refute BasicSignupWhitelist.mail_whitelisted("joe@example.com")
|
||||
refute BasicSignupAllowlist.mail_allowlisted("joe@example.com")
|
||||
end
|
||||
|
||||
test "When set to star, whitelisted" do
|
||||
test "When set to star, allowlisted" do
|
||||
allow_signups_for("*")
|
||||
assert BasicSignupWhitelist.mail_whitelisted("joe@example.com")
|
||||
assert BasicSignupAllowlist.mail_allowlisted("joe@example.com")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
defmodule FunCore.BasicSignupWhitelistTest do
|
||||
defmodule FunCore.BasicSignupAllowlistTest do
|
||||
use ExUnit.Case
|
||||
import FunCore.BasicSignupWhitelist
|
||||
import FunCore.BasicSignupAllowlist
|
||||
|
||||
test "addresses_as_list" do
|
||||
assert addresses_as_list("joe@example.com, jane@example.com") == [
|
||||
@@ -14,27 +14,27 @@ defmodule FunCore.BasicSignupWhitelistTest do
|
||||
assert "jane@example.com" in lst
|
||||
end
|
||||
|
||||
describe "Not whitelisted when allowed list is" do
|
||||
describe "Not allowlisted when allowed list is" do
|
||||
test "not set" do
|
||||
refute(mail_whitelisted_fun(nil, "joe@example.com"))
|
||||
refute(mail_allowlisted_fun(nil, "joe@example.com"))
|
||||
end
|
||||
|
||||
test "empty" do
|
||||
refute(mail_whitelisted_fun("j", "joe@example.com"))
|
||||
refute(mail_allowlisted_fun("j", "joe@example.com"))
|
||||
end
|
||||
end
|
||||
|
||||
describe "Whitelisted when" do
|
||||
test "*" do
|
||||
assert(mail_whitelisted_fun("*", "jane@example.com"))
|
||||
assert(mail_allowlisted_fun("*", "jane@example.com"))
|
||||
end
|
||||
|
||||
test "Multiple set and one match" do
|
||||
assert(mail_whitelisted_fun("joe@example.com, jane@example.com", "jane@example.com"))
|
||||
assert(mail_allowlisted_fun("joe@example.com, jane@example.com", "jane@example.com"))
|
||||
end
|
||||
|
||||
test "Matches with different casings" do
|
||||
assert(mail_whitelisted_fun("joe@Example.com, jane@example.com", "Joe@example.com"))
|
||||
assert(mail_allowlisted_fun("joe@Example.com, jane@example.com", "Joe@example.com"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user