diff --git a/core/test/google_sign_in/plug_test.exs b/core/test/google_sign_in/plug_test.exs
index b214ace60..8a9c6c057 100644
--- a/core/test/google_sign_in/plug_test.exs
+++ b/core/test/google_sign_in/plug_test.exs
@@ -50,7 +50,7 @@ defmodule GoogleSignIn.AuthorizePlug.Test do
{:ok, domain: domain}
end
- test "redirects to SurfConext login page" do
+ test "redirects to Google login page" do
conn =
conn(:get, "/google")
|> init_test_session(%{})
@@ -118,22 +118,26 @@ defmodule GoogleSignIn.CallbackPlug.Test do
given_name = Faker.Person.first_name()
family_name = Faker.Person.last_name()
- GoogleSignIn.register_user(%{
- "sub" => GoogleSignIn.FakeGoogle.sub(),
- "name" => "#{given_name} #{family_name}",
- "email" => email,
- "email_verified" => true,
- "given_name" => given_name,
- "family_name" => family_name,
- "picture" => Faker.Internet.url(),
- "locale" => "en"
- })
+ GoogleSignIn.register_user(
+ %{
+ "sub" => GoogleSignIn.FakeGoogle.sub(),
+ "name" => "#{given_name} #{family_name}",
+ "email" => email,
+ "email_verified" => true,
+ "given_name" => given_name,
+ "family_name" => family_name,
+ "picture" => Faker.Internet.url(),
+ "locale" => "en"
+ },
+ true
+ )
user =
conn(:get, "/google")
|> init_test_session(%{})
|> CallbackPlug.call(:test)
+ assert user.creator == true
assert user.email == email
end
diff --git a/core/test/google_sign_in_test.exs b/core/test/google_sign_in_test.exs
index a6f68d80b..707fb5082 100644
--- a/core/test/google_sign_in_test.exs
+++ b/core/test/google_sign_in_test.exs
@@ -30,12 +30,13 @@ defmodule GoogleSignIn.Test do
"locale" => "en"
}
- {:ok, google_user} = GoogleSignIn.register_user(sso_info)
+ {:ok, google_user} = GoogleSignIn.register_user(sso_info, false)
for key <- Map.keys(sso_info) do
assert Map.get(google_user, String.to_atom(key)) == Map.get(sso_info, key)
end
+ assert google_user.user.creator == false
assert google_user.user.email == Map.get(sso_info, "email")
assert google_user.user.displayname == "#{given_name}"
assert google_user.user.profile.fullname == "#{given_name} #{family_name}"