def testData():
    User.query.delete()
    Project.query.delete()
    User_project.query.delete()
    User.create(username="******",email="*****@*****.**",password="******",firstname=u"리자",lastname=u"관",active=True)
    User.create(username="******",email="*****@*****.**",password="******",firstname=u"원순",lastname=u"박",active=True)
    User.create(username="******",email="*****@*****.**",password="******",firstname=u"길동",lastname=u"홍",active=True)
    User.create(username="******",email="*****@*****.**",password="******",firstname=u"태현",lastname=u"차",active=True)
    User.create(username="******",email="*****@*****.**",password="******",firstname=u"순신",lastname=u"이",active=True)
    Project.create(name=u"어린이집늘리기",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"어린이집을 늘려야 하거든요")
    Project.create(name=u"경로당늘리기",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"경로당을 늘려야 하거든요")
    Project.create(name=u"카페늘리기",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"카페를 늘려야 하거든요")
    Project.create(name=u"고양이 밥주기",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"강아지 밥주기",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"주차장 오천개 확보 사업",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"박원순 생일 파티",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"서영태 생일 파티",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"홍대 길거리 청소 프로젝트",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"태양열 전지 확보 사업",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"청계천 정화 사업",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"2014년 크리스마스 비밀 파티",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"2015년 신년회 프로젝트",start_date=datetime.now(),end_date=(datetime.now()+timedelta(days=7)),description=u"ㅇㅇㅇㅇ")
    User_project.create(u_id=1, p_id=1)
    User_project.create(u_id=2, p_id=1)
    User_project.create(u_id=3, p_id=1)
    User_project.create(u_id=1, p_id=2)
    User_project.create(u_id=2, p_id=2)
    User_project.create(u_id=3, p_id=2)
    User_project.create(u_id=1, p_id=3)
    User_project.create(u_id=2, p_id=3)
    User_project.create(u_id=3, p_id=3)
    flash("테스트 데이터가 생성되었습니다. ID : admin PW: 123456 ", 'success')
    return redirect(url_for('public.home'))
Beispiel #2
0
def register():
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User.create(username=form.username.data,
                               email=form.email.data,
                               password=form.password.data,
                               firstname=form.firstname.data,
                               lastname=form.lastname.data,
                               active=True)
        # new_user.update(commit=True, first_name=form.name.data, last_name=form.familyname.data)
        flash("Thank you for registering. You can now log in.", 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
def register():
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User.create(username=form.username.data,
                        email=form.email.data,
                        password=form.password.data,
                        firstname=form.firstname.data,
                        lastname=form.lastname.data,
                        active=True)
        # new_user.update(commit=True, first_name=form.name.data, last_name=form.familyname.data)
        flash("Thank you for registering. You can now log in.", 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
def load_user(id):
    return User.get_by_id(int(id))
Beispiel #5
0
def testData():
    User.query.delete()
    Project.query.delete()
    User_project.query.delete()
    User.create(username="******",
                email="*****@*****.**",
                password="******",
                firstname=u"리자",
                lastname=u"관",
                active=True)
    User.create(username="******",
                email="*****@*****.**",
                password="******",
                firstname=u"원순",
                lastname=u"박",
                active=True)
    User.create(username="******",
                email="*****@*****.**",
                password="******",
                firstname=u"길동",
                lastname=u"홍",
                active=True)
    User.create(username="******",
                email="*****@*****.**",
                password="******",
                firstname=u"태현",
                lastname=u"차",
                active=True)
    User.create(username="******",
                email="*****@*****.**",
                password="******",
                firstname=u"순신",
                lastname=u"이",
                active=True)
    Project.create(name=u"어린이집늘리기",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"어린이집을 늘려야 하거든요")
    Project.create(name=u"경로당늘리기",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"경로당을 늘려야 하거든요")
    Project.create(name=u"카페늘리기",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"카페를 늘려야 하거든요")
    Project.create(name=u"고양이 밥주기",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"강아지 밥주기",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"주차장 오천개 확보 사업",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"박원순 생일 파티",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"서영태 생일 파티",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"홍대 길거리 청소 프로젝트",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"태양열 전지 확보 사업",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"청계천 정화 사업",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"2014년 크리스마스 비밀 파티",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    Project.create(name=u"2015년 신년회 프로젝트",
                   start_date=datetime.now(),
                   end_date=(datetime.now() + timedelta(days=7)),
                   description=u"ㅇㅇㅇㅇ")
    User_project.create(u_id=1, p_id=1)
    User_project.create(u_id=2, p_id=1)
    User_project.create(u_id=3, p_id=1)
    User_project.create(u_id=1, p_id=2)
    User_project.create(u_id=2, p_id=2)
    User_project.create(u_id=3, p_id=2)
    User_project.create(u_id=1, p_id=3)
    User_project.create(u_id=2, p_id=3)
    User_project.create(u_id=3, p_id=3)
    flash("테스트 데이터가 생성되었습니다. ID : admin PW: 123456 ", 'success')
    return redirect(url_for('public.home'))
 def test_check_password(self):
     user = User.create(username="******", email="*****@*****.**",
                 password="******")
     assert user.check_password('foobarbaz123') is True
     assert user.check_password("barfoobaz") is False
Beispiel #7
0
def load_user(id):
    return User.get_by_id(int(id))
 def test_created_at_defaults_to_datetime(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert bool(user.created_at)
     assert isinstance(user.created_at, dt.datetime)
 def test_password_is_nullable(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert user.password is None
    def test_get_by_id(self):
        user = User('foo', '*****@*****.**')
        user.save()

        retrieved = User.get_by_id(user.id)
        assert retrieved == user
Beispiel #11
0
 def test_check_password(self):
     user = User.create(username="******",
                        email="*****@*****.**",
                        password="******")
     assert user.check_password('foobarbaz123') is True
     assert user.check_password("barfoobaz") is False
Beispiel #12
0
 def test_password_is_nullable(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert user.password is None
Beispiel #13
0
 def test_created_at_defaults_to_datetime(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert bool(user.created_at)
     assert isinstance(user.created_at, dt.datetime)
Beispiel #14
0
    def test_get_by_id(self):
        user = User('foo', '*****@*****.**')
        user.save()

        retrieved = User.get_by_id(user.id)
        assert retrieved == user