Ejemplo n.º 1
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     Role.insert_roles()
     self.client = self.app.test_client()
Ejemplo n.º 2
0
def index():
    Role.insert_roles()
    role = Role.query.filter_by(name='User').first()
    user = User.query.filter_by(role=role).all()
    for user1 in user:
        print user1.username
    return render_template('main/index.html')
Ejemplo n.º 3
0
 def test_anonymous_user(self):
     Role.insert_roles()
     u = AnonymousUser()
     self.assertFalse(u.can(Permission.COMMENT))
     self.assertFalse(u.can(Permission.WRITE))
     self.assertFalse(u.can(Permission.FOLLOW))
     self.assertFalse(u.can(Permission.ADMIN))
     self.assertFalse(u.can(Permission.MODERATE))
Ejemplo n.º 4
0
 def test_user_role(self):
     Role.insert_roles()
     u = User(name='ose', password='******', email='*****@*****.**')
     self.assertTrue(u.can(Permission.COMMENT))
     self.assertTrue(u.can(Permission.WRITE))
     self.assertTrue(u.can(Permission.FOLLOW))
     self.assertFalse(u.can(Permission.ADMIN))
     self.assertFalse(u.can(Permission.MODERATE))
Ejemplo n.º 5
0
 def test_admin(self):
     Role.insert_roles()
     u = User(name='ose',
              password='******',
              email='*****@*****.**',
              id=1)
     self.assertTrue(u.can(Permission.COMMENT))
     self.assertTrue(u.can(Permission.WRITE))
     self.assertTrue(u.can(Permission.FOLLOW))
     self.assertTrue(u.can(Permission.ADMIN))
     self.assertTrue(u.can(Permission.MODERATE))
Ejemplo n.º 6
0
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.drop_all()
        db.create_all()
        db.session.commit()

        Role.insert_roles()
        User.insert_root_admin()

        self.client = self.app.test_client()
Ejemplo n.º 7
0
def deploy():
    """Run deployment tasks and prepare necessary data"""
    upgrade()
    Role.insert_roles()
    User.insert_root_admin()
Ejemplo n.º 8
0
def deploy():
    """Run deployment tasks."""
    upgrade()
    Role.insert_roles()
    User.insert_root_admin()