def test_uset_setup(self): new_user = user_("alessio","solamente","*****@*****.**","alesssoi","binos","admin") db.session.add(new_user) db.session.commit test = db.session.query(user_).all() for t in test: t.user assert t.user == "alessio"
def test_uset_setup(self): new_user = user_("alessio", "solamente", "*****@*****.**", "alesssoi", "binos", "admin") db.session.add(new_user) db.session.commit test = db.session.query(user_).all() for t in test: t.user assert t.user == "alessio"
def test_on_505(self): bad_user = user_(user="******", password="******", email="*****@*****.**", first_name="traco", last_name="sorra", profile_type="users") db.session.add(bad_user) db.session.commit() respoce = self.login('jeremy1', 'corallo') self.assertEqual(respoce.status_code, 500)
def new_users(): error = None form = new_register_user(request.form) if form.validate_on_submit(): new_user = user_( form.user.data, bycrypt_on_pass_user.generate_password_hash(form.password.data), form.email.data, form.first_name.data, form.last_name.data, str(form.select_profile.data)) try: db.session.add(new_user) db.session.commit() flash('New user register') return redirect(url_for('user.user_page')) except IntegrityError: error = "username and/or email exist" return render_template('new_users.html', form=form, error=error, current_time=datetime.utcnow()) return render_template('new_users.html', form=form, error=error, current_time=datetime.utcnow())
def test_on_505(self): bad_user= user_(user="******",password="******",email="*****@*****.**",first_name="traco",last_name="sorra",profile_type="users") db.session.add(bad_user) db.session.commit() respoce = self.login('jeremy1', 'corallo') self.assertEqual(respoce.status_code,500)
__author__ = 'Alessio' from project import model_ from project import db, bycrypt_on_pass_user primo = model_.profile_type_(name="Admin") #print primo.name #terzo = model_.profile_type_(name="User",permission=1) ad=model_.user_("administrator",bycrypt_on_pass_user.generate_password_hash('binocchio1977'),"*****@*****.**","alessio","bino",primo.name) db.session.add(ad) db.session.commit() my_q = db.session.query(model_.profile_type_.name).all() print my_q
def add_user(self): db.session.add( user_("massimo", 'binocchio19q778', "*****@*****.**", "alessio", "bino", "Admin")) db.session.commit()
__author__ = 'Alessio' from project import model_ from project import db, bycrypt_on_pass_user primo = model_.profile_type_(name="Admin") #print primo.name #terzo = model_.profile_type_(name="User",permission=1) ad = model_.user_("administrator", bycrypt_on_pass_user.generate_password_hash('binocchio1977'), "*****@*****.**", "alessio", "bino", primo.name) db.session.add(ad) db.session.commit() my_q = db.session.query(model_.profile_type_.name).all() print my_q