neuroscout/tests/conftest.py
def add_users(app, db, session):
    """ Adds a test user to db """
    from flask_security import SQLAlchemyUserDatastore

    user_datastore = SQLAlchemyUserDatastore(db, User, Role)

    user1 = 'test1@gmail.com'
    pass1 = 'test1'

    user2 = 'test2@gmail.com'
    pass2 = 'test2'

    user_datastore.create_user(email=user1, password=encrypt_password(pass1),
                               user_name='testuser',
                               confirmed_at=datetime.datetime.now())
    session.commit()
    id_1 = user_datastore.find_user(email=user1).id

    user_datastore.create_user(email=user2, password=encrypt_password(pass2),
                               user_name='testuser2',
                               confirmed_at=datetime.datetime.now())
    session.commit()
    id_2 = user_datastore.find_user(email=user2).id

    yield (id_1, id_2), ((user1, pass1), (user2, pass2))
 Adds a test user to db 
Adds a test user to db
Adds a test user to db
def add_users(app, db, session):
    from flask_security import SQLAlchemyUserDatastore
    user_datastore = SQLAlchemyUserDatastore(db, User, Role)
    user1 = 'test1@gmail.com'
    pass1 = 'test1'
    user2 = 'test2@gmail.com'
    pass2 = 'test2'
    user_datastore.create_user(email=user1, password=encrypt_password(pass1),
                               user_name='testuser',
                               confirmed_at=datetime.datetime.now())
    session.commit()
    id_1 = user_datastore.find_user(email=user1).id
    user_datastore.create_user(email=user2, password=encrypt_password(pass2),
                               user_name='testuser2',
                               confirmed_at=datetime.datetime.now())
    session.commit()
    id_2 = user_datastore.find_user(email=user2).id
    yield (id_1, id_2), ((user1, pass1), (user2, pass2))
def add_users ( app , db , session ) : from flask_security import SQLAlchemyUserDatastore user_datastore = SQLAlchemyUserDatastore ( db , User , Role ) user1 = 'test1@gmail.com' pass1 = 'test1' user2 = 'test2@gmail.com' pass2 = 'test2' user_datastore . create_user ( email = user1 , password = encrypt_password ( pass1 ) , user_name = 'testuser' , confirmed_at = datetime . datetime . now ( ) ) session . commit ( ) id_1 = user_datastore . find_user ( email = user1 ) . id user_datastore . create_user ( email = user2 , password = encrypt_password ( pass2 ) , user_name = 'testuser2' , confirmed_at = datetime . datetime . now ( ) ) session . commit ( ) id_2 = user_datastore . find_user ( email = user2 ) . id yield ( id_1 , id_2 ) , ( ( user1 , pass1 ) , ( user2 , pass2 ) )
Adds a test user to db
Adds a test user to db
""" Adds a test user to db """
app
db
session