fix: update dependencies and fix unit tests

This commit is contained in:
ziirish 2023-04-10 18:22:58 +02:00
parent 7f2832d1fa
commit 2de20db7fb
8 changed files with 27 additions and 33 deletions

View file

@ -11,13 +11,8 @@
import flask_restx.fields import flask_restx.fields
from flask_restx.fields import * # noqa # pylint: disable=locally-disabled, wildcard-import, unused-wildcard-import from flask_restx.fields import * # noqa # pylint: disable=locally-disabled, wildcard-import, unused-wildcard-import
from .my_fields import ( from .my_fields import DateTimeHuman # noqa
BackupNumber, from .my_fields import BackupNumber, DateTime, LocalizedString, SafeString
DateTime,
DateTimeHuman, # noqa
LocalizedString,
SafeString,
)
__all__ = flask_restx.fields.__all__ + ( __all__ = flask_restx.fields.__all__ + (
DateTime, DateTime,

View file

@ -236,7 +236,7 @@ def create_app(conf=None, verbose=0, logfile=None, **kwargs):
cache.init_app( cache.init_app(
app, app,
config={ config={
"CACHE_TYPE": "redis", "CACHE_TYPE": "flask_caching.backends.redis",
"CACHE_REDIS_HOST": host, "CACHE_REDIS_HOST": host,
"CACHE_REDIS_PORT": port, "CACHE_REDIS_PORT": port,
"CACHE_REDIS_PASSWORD": pwd, "CACHE_REDIS_PASSWORD": pwd,

View file

@ -11,7 +11,7 @@ from flask_caching import Cache
cache = Cache( cache = Cache(
config={ config={
"CACHE_TYPE": "simple", "CACHE_TYPE": "flask_caching.backends.simple",
"CACHE_THRESHOLD": 50, "CACHE_THRESHOLD": 50,
"CACHE_DEFAULT_TIMEOUT": 7200, "CACHE_DEFAULT_TIMEOUT": 7200,
} }

View file

@ -14,8 +14,6 @@ from flask_login import current_user
from .._compat import to_unicode from .._compat import to_unicode
from ..config import config from ..config import config
babel = Babel()
LANGUAGES = { LANGUAGES = {
"en": to_unicode("English"), "en": to_unicode("English"),
"fr": to_unicode("Français"), "fr": to_unicode("Français"),
@ -25,7 +23,6 @@ LANGUAGES = {
config["LANGUAGES"] = LANGUAGES config["LANGUAGES"] = LANGUAGES
@babel.localeselector
def get_locale(): def get_locale():
locale = None locale = None
if current_user and not current_user.is_anonymous: if current_user and not current_user.is_anonymous:
@ -35,3 +32,6 @@ def get_locale():
if locale not in LANGUAGES: if locale not in LANGUAGES:
locale = None locale = None
return locale or request.accept_languages.best_match(config["LANGUAGES"].keys()) return locale or request.accept_languages.best_match(config["LANGUAGES"].keys())
babel = Babel()

View file

@ -18,7 +18,6 @@ Burp-UI Meta package for ##TPL## requirements
""" """
from burpui_##TPL## import __author__, __author_email__, __description__, \ from burpui_##TPL## import __author__, __author_email__, __description__, \
name = __title__
author = __author__ author = __author__
author_email = __author_email__ author_email = __author_email__
description = __description__ description = __description__

View file

@ -1,17 +1,17 @@
trio==0.19.0 trio==0.22.0
Flask==2.0.3 Flask==2.2.3
Flask-Login==0.6.2 Flask-Login==0.6.2
Flask-Babel==2.0.0 Flask-Babel==3.0.1
Flask-WTF==0.15.1 Flask-WTF==0.15.1
flask-restx==1.0.3 flask-restx==1.1.0
Flask-Caching==1.10.1 Flask-Caching==2.0.2
Flask-Session==0.4.0 Flask-Session==0.4.0
WTForms==2.3.3 WTForms==3.0.0
arrow==1.1.1 arrow==1.2.3
pluginbase==1.0.1 pluginbase==1.0.1
tzlocal==3.0 tzlocal==4.3
pyOpenSSL==22.1.0 pyOpenSSL==23.0.0
configobj==5.0.6 configobj==5.0.8
async_generator==1.10 async_generator==1.10
Click==7.1.2 Click==8.1.3
python-pam==1.8.4 python-pam==2.0.2

View file

@ -245,13 +245,8 @@ def readme():
sys.path.insert(0, os.path.join(ROOT)) sys.path.insert(0, os.path.join(ROOT))
from burpui.desc import ( from burpui.desc import __description__ # noqa
__author__, from burpui.desc import __author__, __author_email__, __title__, __url__
__author_email__,
__description__, # noqa
__title__,
__url__,
)
name = __title__ name = __title__
author = __author__ author = __author__

View file

@ -34,6 +34,7 @@ def app(mocker):
from burpui.ext.sql import db from burpui.ext.sql import db
from burpui.models import Session, Task # noqa from burpui.models import Session, Task # noqa
del bui.extensions["sqlalchemy"]
bui.config["WITH_SQL"] = True bui.config["WITH_SQL"] = True
create_db(bui, True) create_db(bui, True)
db.create_all() db.create_all()
@ -83,7 +84,11 @@ def test_current_session(app):
session_manager.store_session("toto") session_manager.store_session("toto")
assert session_manager.session_expired() is False assert session_manager.session_expired() is False
sess = Session.query.filter_by(uuid=session_manager.get_session_id()).first() sess = (
db.session.query(Session)
.filter_by(uuid=session_manager.get_session_id())
.first()
)
sess.timestamp = datetime.utcfromtimestamp(0) sess.timestamp = datetime.utcfromtimestamp(0)
db.session.commit() db.session.commit()
assert session_manager.session_expired() is True assert session_manager.session_expired() is True