Implement the remaining registry tests in the new py.test format
This commit is contained in:
parent
77adf9dd77
commit
8c1b0e673c
7 changed files with 1200 additions and 62 deletions
|
@ -6,9 +6,11 @@ import pytest
|
|||
import shutil
|
||||
from flask import Flask, jsonify
|
||||
from flask_login import LoginManager
|
||||
from flask_principal import identity_loaded, Permission, Identity, identity_changed, Principal
|
||||
from peewee import SqliteDatabase, savepoint, InternalError
|
||||
|
||||
from app import app as application
|
||||
from auth.permissions import on_identity_loaded
|
||||
from data import model
|
||||
from data.database import close_db_filter, db, configure
|
||||
from data.model.user import LoginWrappedDBUser
|
||||
|
@ -119,6 +121,9 @@ def appconfig(database_uri):
|
|||
'autorollback': True,
|
||||
},
|
||||
"DB_TRANSACTION_FACTORY": _create_transaction,
|
||||
"DATA_MODEL_CACHE_CONFIG": {
|
||||
'engine': 'inmemory',
|
||||
},
|
||||
}
|
||||
return conf
|
||||
|
||||
|
@ -168,6 +173,12 @@ def app(appconfig, initialized_db):
|
|||
def load_user(user_uuid):
|
||||
return LoginWrappedDBUser(user_uuid)
|
||||
|
||||
@identity_loaded.connect_via(app)
|
||||
def on_identity_loaded_for_test(sender, identity):
|
||||
on_identity_loaded(sender, identity)
|
||||
|
||||
Principal(app, use_sessions=False)
|
||||
|
||||
app.url_map.converters['regex'] = RegexConverter
|
||||
app.url_map.converters['apirepopath'] = APIRepositoryPathConverter
|
||||
app.url_map.converters['repopath'] = RepositoryPathConverter
|
||||
|
|
Reference in a new issue