Exemplo n.º 1
0
def create_users():
    """ Create users """
    for u in  (('user1','*****@*****.**','password',['pwd1'],True),
               ('user2','*****@*****.**','password',['pwd2'],True),
               ('user3','*****@*****.**','password',['pwd3'],True)):
        user_datastore.create_user(username=u[0], email=u[1], password=u[2],
                                   roles=u[3], active=u[4])
        db.session.commit()
Exemplo n.º 2
0
    def _initialize_db(self, *args, **kwargs):
        """
        DB creation routine with user population
        """

        self.db_fd, self.temp_name = self._create_db()
        app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////%s' % self.temp_name

        ResetDB().run()

        for role in ('admin', 'agent'):
            user_datastore.create_role(name=role, description=role)

        db.session.commit()

        self.test_user_list = (('test123', '*****@*****.**', 'password',
                                ['agent'], True),)
        u = self.test_user_list[0]

        self.user = user_datastore.create_user(username=u[0], email=u[1],
                                               password=u[2], roles=u[3],
                                               active=u[4])
        InitClass.user = self.user
        #self.user = user_datastore.find_user(username=u[0])
        db.session.commit()