示例#1
0
def bootstrap():
    from sqlalchemy.exc import IntegrityError
    try:
        u = User()
        u.first_name = u'Example'
        u.last_name = u'Manager'
        u.email_address = u'*****@*****.**'
        u.password = u'managepass'
        u.admin = True

        db.session.add(u)

        u1 = User()
        u1.first_name = u'Example'
        u1.last_name = u'User'
        u1.email_address = u'*****@*****.**'
        u1.password = u'test'
        u1.tracking_key = 123456

        db.session.add(u1)

        db.session.commit()
    except IntegrityError:
        print 'Warning, there was a problem adding your auth data, it may have already been added:'
        import traceback
        print traceback.format_exc()
        db.session.rollback()
        print 'Continuing with bootstrapping...'
示例#2
0
def test_user(db):
    user = User(email_address=u"*****@*****.**",
                password=u"secret123",
                first_name=u"test")
    db.session.add(user)
    db.session.commit()
    return user
示例#3
0
 def setup(self):
     self.bill = User(first_name='bill',
                      email_address='*****@*****.**',
                      password='******')
     db.session.add(self.bill)
     db.session.commit()
     self.login('*****@*****.**', 'pass')
示例#4
0
def test_user(db):
    user = User(email_address=u'*****@*****.**',
                password=u'secret123',
                first_name=u'test')
    db.session.add(user)
    db.session.commit()
    return user
示例#5
0
def test_user():
    u1 = User()
    u1.first_name = u'Example'
    u1.last_name = u'User'
    u1.email_address = u'*****@*****.**'
    u1.password = u1.original_password = u'test'
    u1.tracking_key = 123456
    return u1
示例#6
0
def test_admin():
    u = User()
    u.first_name = u'Example'
    u.last_name = u'Manager'
    u.email_address = u'*****@*****.**'
    u.password = u.original_password = u'managepass'
    u.admin = True
    return u
示例#7
0
def test_admin():
    u = User()
    u.first_name = u"Example"
    u.last_name = u"Manager"
    u.email_address = u"*****@*****.**"
    u.password = u.original_password = u"managepass"
    u.admin = True
    return u
示例#8
0
def test_user():
    u1 = User()
    u1.first_name = u"Example"
    u1.last_name = u"User"
    u1.email_address = u"*****@*****.**"
    u1.password = u1.original_password = u"test"
    u1.tracking_key = 123456
    u1.tracking_delay = 2
    return u1
示例#9
0
文件: club.py 项目: imclab/skylines
def create_pilot_post(form):
    pilot = User(first_name=form.first_name.data,
                 last_name=form.last_name.data,
                 email_address=form.email_address.data,
                 club=g.club)

    db.session.add(pilot)
    db.session.commit()

    return redirect(url_for('.pilots'))
示例#10
0
def bill(app):
    bill = User(first_name='bill',
                email_address='*****@*****.**',
                password='******')

    with app.app_context():
        db.session.add(bill)
        db.session.commit()

    return bill
示例#11
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return redirect(url_for('index'))
示例#12
0
def fixtures(db_session):
    data = {
        'john':
        User(first_name=u'John', last_name=u'Doe', password='******'),
        'jane':
        User(first_name=u'Jane', last_name=u'Doe', password='******'),
        'lva':
        Club(name=u'LV Aachen', website='https://www.lv-aachen.de'),
        'sfn':
        Club(name=u'Sportflug Niederberg'),
        'edka':
        Airport(name=u'Aachen-Merzbrück',
                country_code='DE',
                icao='EDKA',
                frequency='122.875'),
        'mbg':
        Airport(name=u'Meiersberg', country_code='DE'),
    }

    for v in data.itervalues():
        db_session.add(v)

    db_session.commit()
    return data
示例#13
0
def test_users(n=50):
    fake = Faker(locale='de_DE')
    fake.seed(42)

    users = []
    for i in xrange(n):
        u = User()
        u.first_name = fake.first_name()
        u.last_name = fake.last_name()
        u.email_address = fake.email()
        u.password = u.original_password = fake.password()
        u.tracking_key = fake.random_number(digits=6)

        users.append(u)

    return users
示例#14
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    flash(
        _('Welcome to SkyLines, %(user)s! You can now log in and share your flights with the world!',
          user=user))

    return redirect(url_for('index'))
示例#15
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    if form.club_id.data:
        user.club_id = form.club_id.data

    user.created_ip = request.remote_addr
    user.generate_tracking_key()
    db.session.add(user)

    create_new_user_event(user)
    if user.club_id:
        create_club_join_event(user.club_id, user)

    db.session.commit()

    return redirect(url_for('index'))
示例#16
0
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error="invalid-request"), 400

    try:
        data = (CurrentUserSchema(only=("email", "firstName", "lastName",
                                        "password")).load(json).data)
    except ValidationError as e:
        return jsonify(error="validation-failed", fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return jsonify(user=UserSchema().dump(user).data)
示例#17
0
def fixtures(db_session):
    owner = User(first_name=u'John', last_name=u'Doe', password='******')
    db_session.add(owner)

    created_at = datetime(2016, 01, 15, 12, 34, 56)

    data = {
        'john':
        owner,
        'lva':
        Club(name=u'LV Aachen',
             website=u'http://www.lv-aachen.de',
             owner=owner,
             time_created=created_at),
        'sfn':
        Club(name=u'Sportflug Niederberg', time_created=created_at),
    }

    for v in data.itervalues():
        db_session.add(v)

    db_session.commit()
    return data
示例#18
0
def jane(**kwargs):
    user = User(first_name=u"Jane",
                last_name=u"Doe",
                email_address=u"*****@*****.**")
    user.original_password = user.password = u"johnny"
    return user.apply_kwargs(kwargs)
示例#19
0
def max(**kwargs):
    user = User(first_name=u"Max",
                last_name=u"Mustermann",
                email_address=u"*****@*****.**")
    user.original_password = user.password = u"secret123"
    return user.apply_kwargs(kwargs)
示例#20
0
def max(**kwargs):
    user = User(first_name=u'Max',
                last_name=u'Mustermann',
                email_address=u'*****@*****.**')
    user.original_password = user.password = u'secret123'
    return user.apply_kwargs(kwargs)
示例#21
0
def jane(**kwargs):
    user = User(first_name=u'Jane',
                last_name=u'Doe',
                email_address=u'*****@*****.**')
    user.original_password = user.password = u'johnny'
    return user.apply_kwargs(kwargs)
示例#22
0
    return render_template('ember-page.jinja', active_page='settings')


@users_blueprint.route('/new', methods=['POST'])
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error='invalid-request'), 400

    try:
        data = CurrentUserSchema(only=('email', 'firstName', 'lastName',
                                       'password')).load(json).data
    except ValidationError, e:
        return jsonify(error='validation-failed', fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    flash(
        _('Welcome to SkyLines, %(user)s! You can now log in and share your flights with the world!',
          user=user))

    return jsonify(user=UserSchema().dump(user).data)