1
0
forked from ScoDoc/ScoDoc

tweaks for install on Mac + fix test users models

This commit is contained in:
Emmanuel Viennet 2021-07-11 23:49:38 +02:00
parent 9fc246b7d0
commit 7d7b4df103
3 changed files with 4 additions and 5 deletions

View File

@ -3,4 +3,4 @@
disable=bad-continuation disable=bad-continuation
[TYPECHECK] [TYPECHECK]
ignored-classes=Permission ignored-classes=Permission,SQLObject,Registrant,scoped_session

View File

@ -2,7 +2,6 @@ alembic==1.6.5
Babel==2.9.1 Babel==2.9.1
blinker==1.4 blinker==1.4
click==8.0.1 click==8.0.1
cracklib==2.9.3
dnspython==2.1.0 dnspython==2.1.0
dominate==2.6.0 dominate==2.6.0
email-validator==1.1.3 email-validator==1.1.3
@ -24,7 +23,6 @@ Jinja2==3.0.1
Mako==1.1.4 Mako==1.1.4
MarkupSafe==2.0.1 MarkupSafe==2.0.1
Pillow==8.3.1 Pillow==8.3.1
pkg-resources==0.0.0
psycopg2==2.9.1 psycopg2==2.9.1
PyJWT==2.1.0 PyJWT==2.1.0
python-dateutil==2.8.1 python-dateutil==2.8.1

View File

@ -5,7 +5,6 @@
Usage: python -m unittest tests.test_users Usage: python -m unittest tests.test_users
""" """
import os
import unittest import unittest
from flask import current_app from flask import current_app
@ -19,6 +18,8 @@ DEPT = "XX"
class UserModelCase(unittest.TestCase): class UserModelCase(unittest.TestCase):
"""Test user, roles and permissions"""
def setUp(self): def setUp(self):
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://" app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://"
app.app_context().push() app.app_context().push()
@ -112,7 +113,7 @@ class UserModelCase(unittest.TestCase):
self.assertTrue(u.has_permission(perm, dept)) self.assertTrue(u.has_permission(perm, dept))
# Le grand admin a accès à tous les départements: # Le grand admin a accès à tous les départements:
self.assertTrue(u.has_permission(perm, dept + "XX")) self.assertTrue(u.has_permission(perm, dept + "XX"))
self.assertTrue("Admin" == u.roles[0].name) self.assertTrue(u.roles[0].name == "SuperAdmin")
def test_create_delete(self): def test_create_delete(self):
u = User(user_name="dupont", nom="Dupont", prenom="Pierre") u = User(user_name="dupont", nom="Dupont", prenom="Pierre")