Commit 8895480f authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_oauth_google_login: Extend test to make sure is impossible create a new...

erp5_oauth_google_login: Extend test to make sure is impossible create a new person using user id provided by Google
parent 86e78318
......@@ -29,6 +29,7 @@ import json
import httplib
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from erp5.component.extension import GoogleLoginUtility
from Products.ERP5.Document.Person import UserExistsError
CLIENT_ID = "a1b2c3"
SECRET_KEY = "3c2ba1"
......@@ -108,6 +109,9 @@ class TestGoogleLogin(ERP5TypeTestCase):
response = self.portal.ERP5Site_receiveGoogleCallback(code=CODE)
self.assertEqual(self.portal.absolute_url(), response)
def create_user_that_already_exists(self):
self.portal.person_module.newContent(portal_type="Person", user_id=CODE)
def test_create_user_with_google_id(self):
self.login()
user_id = getUserId(None)
......@@ -135,4 +139,6 @@ class TestGoogleLogin(ERP5TypeTestCase):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEqual(user_id, person.getReference())
self.assertEqual(user_entry["first_name"], person.getFirstName())
self.assertEqual(user_entry["last_name"], person.getLastName())
\ No newline at end of file
self.assertEqual(user_entry["last_name"], person.getLastName())
self.login()
self.assertRaises(UserExistsError, self.create_user_that_already_exists)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment