def test_invalid_email(self, user_mgt_app, arg): with pytest.raises(ValueError): auth.create_user(email=arg, app=user_mgt_app)
def test_invalid_phone(self, user_mgt_app, arg): with pytest.raises(ValueError): auth.create_user(phone_number=arg, app=user_mgt_app)
def test_create_user_error(self, user_mgt_app): _instrument_user_manager(user_mgt_app, 500, '{"error":"test"}') with pytest.raises(auth.AuthError) as excinfo: auth.create_user(app=user_mgt_app) assert excinfo.value.code == _user_mgt.USER_CREATE_ERROR assert '{"error":"test"}' in str(excinfo.value)
def create_user_with_id(): # [START create_user_with_id] user = auth.create_user(uid='some-uid', email='*****@*****.**', phone_number='+15555550100') print('Sucessfully created new user: {0}'.format(user.uid))
def test_invalid_property(self, user_mgt_app): with pytest.raises(TypeError): auth.create_user(unsupported='value', app=user_mgt_app)
def test_invalid_password(self, user_mgt_app, arg): with pytest.raises(ValueError): auth.create_user(password=arg, app=user_mgt_app)
def test_invalid_display_name(self, user_mgt_app, arg): with pytest.raises(ValueError): auth.create_user(display_name=arg, app=user_mgt_app)
def create( self, # required: email=None, password=None, verify_password=None, # optionals: name=None, phone_number=None, photo_url=None, email_verified=False, ): # check parameters. response = dev0s.response.parameters.check(default=None, parameters={ "email": email, "password": password, "verify_password": verify_password, }) # check password. password = str(password) verify_password = str(verify_password) if len(password) < 8: return dev0s.response.error( "The password must contain at least 8 characters.") elif password.lower() == password: return dev0s.response.error( "The password must regular and capital letters.") elif password != verify_password: return dev0s.response.error("Passwords do not match.") # create. try: user = auth.create_user(email=email, email_verified=email_verified, phone_number=phone_number, password=password, display_name=name, photo_url=photo_url, disabled=False) success = True except Exception as e: success = False error = e # handle error. if not success: return dev0s.response.error( f"Failed to create user [{email}], error: {error}") # handle success. return dev0s.response.success(f"Successfully created user [{email}].", { "user": user, "uid": user.uid, "email": user.email, })
'ifts11notas-firebase-adminsdk-evg7d-26793f5162.json') firebase_admin.initialize_app(cred) db = firestore.client() i = 0 d = data[i] while d and i < len(data): if d[2] == 'Curso': continue mail = d[10] nombre = d[8] try: print("---> Creando: ", d[10]) user = auth.create_user(email=mail, password='******') except: print("---> Loggeando: ", d[10]) user = auth.get_user_by_email(mail) alumno = { "dni": str(d[9]).replace('.0', ''), "nombre": d[8], "mail": d[10], "cohorte": str(d[6]).replace('.0', ''), "cuatrimestre_ingreso": str(d[7]).replace('.0', ''), "notas": [] } while d and mail == d[10]: nota = { "codigo": d[5],