Esempio n. 1
0
def init_model():
    ziggurat_model_init(User,
                        Group,
                        UserGroup,
                        GroupPermission,
                        UserPermission,
                        UserResourcePermission,
                        GroupResourcePermission,
                        Resource,
                        ExternalIdentity,
                        passwordmanager=None)
Esempio n. 2
0
def init_model():
    ziggurat_model_init(User, Group, UserGroup, GroupPermission, UserPermission,
                   UserResourcePermission, GroupResourcePermission, Resource,
                   ExternalIdentity, passwordmanager=None)
Esempio n. 3
0

class ExternalIdentity(ExternalIdentityMixin, Base):
    pass


class User(UserMixin, Base):
    __possible_permissions__ = ["root", "alter_users", "custom1"]


ziggurat_model_init(
    User,
    Group,
    UserGroup,
    GroupPermission,
    UserPermission,
    UserResourcePermission,
    GroupResourcePermission,
    Resource,
    ExternalIdentity,
)


@pytest.fixture
def db_session(request):
    sql_str = os.environ.get("DB_STRING", "sqlite://")
    engine = create_engine(sql_str)
    engine.echo = True
    # pyramid way
    maker = sessionmaker(bind=engine)
    Base.metadata.bind = engine

class UserResourcePermission(UserResourcePermissionMixin, Base):
    pass


class ExternalIdentity(ExternalIdentityMixin, Base):
    pass


class User(UserMixin, Base):
    __possible_permissions__ = ['root', 'alter_users', 'custom1']


ziggurat_model_init(User, Group, UserGroup, GroupPermission, UserPermission,
                    UserResourcePermission, GroupResourcePermission, Resource,
                    ExternalIdentity)


@pytest.fixture
def db_session(request):
    sql_str = os.environ.get(
        "DB_STRING",
        'sqlite://',
    )
    engine = create_engine(sql_str)
    engine.echo = True
    # pyramid way
    maker = sessionmaker(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.drop_all(engine)