Loading Pipfile.lock +3 −3 Original line number Diff line number Diff line Loading @@ -52,11 +52,11 @@ }, "authlib": { "hashes": [ "sha256:b61c6c6fd230c4ba8602fd85ee9a40e6dc859387699a1cd1f7247c4b109dcc17", "sha256:eda3e5af921a368091fef721d6d169bcff2aa0003d05113bc26e127f58c9a5e8" "sha256:3a226f231e962a16dd5f6fcf0c113235805ba206e294717a64fa8e04ae3ad9c4", "sha256:9741db6de2950a0a5cefbdb72ec7ab12f7e9fd530ff47219f1530e79183cbaaf" ], "index": "pypi", "version": "==0.10" "version": "==0.11" }, "billiard": { "hashes": [ Loading management/data/data_test.py +5 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy from management.data.shared import DataFactory from portal.database.models import Review, Secret, Submission, SubmissionState from portal.database.models import Review, Secret, SubmissionState from portal.tools import time Loading @@ -23,8 +23,10 @@ def init_test_data(app: Flask, db: SQLAlchemy): lecturer1 = factory.create_user(username='lecturer1', name='Courses Owner', uco=1010) # courses test_course1 = factory.create_course(codename='testcourse1', name='Test Course One') test_course2 = factory.create_course(codename='testcourse2', name='test Course Two') test_course1 = factory.create_course(codename='testcourse1', name='Test Course One', faculty_id=100) test_course2 = factory.create_course(codename='testcourse2', name='test Course Two', faculty_id=100) # groups tc1_students = factory.create_group(course=test_course1, name="seminar01") Loading management/data/shared.py +4 −1 Original line number Diff line number Diff line Loading @@ -129,12 +129,15 @@ class DataFactory: def create_worker(self, name: str, url: str) -> Worker: return self.__create_entity(Worker, name=name, url=url) def create_course(self, codename, name=None, token=None) -> Course: def create_course(self, codename, name=None, token=None, faculty_id=None) \ -> Course: name = name or codename desc = name + "'s description" course = self.__create_entity( Course, codename=codename, name=name, description=desc) course.notes_access_token = token or f"{codename}_token" if faculty_id is not None: course.faculty_id = faculty_id return course def create_group(self, course: Course, name: str) -> Group: Loading portal/__init__.py +3 −4 Original line number Diff line number Diff line """ Main Portal module """ import logging import os from typing import Union Loading @@ -28,7 +28,7 @@ storage_wrapper = Storage() migrate = Migrate(db=db) ldap_wrapper = LDAPWrapper() is_api_factory = IsApiFactory() log = logger.get_logger(__name__) log = logging.getLogger(__name__) def configure_app(app: Flask, env: str = None, Loading Loading @@ -116,7 +116,7 @@ def create_app(environment: str = None): Returns(Flask): Flask application instance """ app = Flask('portal') app = Flask(__name__) # app configuration configure_app(app, env=environment) _log_config(app) Loading @@ -129,7 +129,6 @@ def create_app(environment: str = None): rest.gitlab.register_gitlab_app(app) rest.register_namespaces(app) return app Loading portal/config.py +12 −1 Original line number Diff line number Diff line Loading @@ -22,10 +22,16 @@ log = logger.get_logger(__name__) class Config(object): """Base configuration """ ENV = os.getenv('ENV', 'development') FLASK_ENV = os.getenv('FLASK_ENV', ENV) # Base dirs PROJECT_ROOT = paths.ROOT_DIR APP_DIR = paths.ROOT_DIR / 'portal' # FRONTEND FRONTEND_URL = os.getenv('FRONTEND_URL', 'http://localhost:4200') # Secrets and JWT Config SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' JWT_SECRET_KEY = os.environ.get('JWT_SECRET_KEY') or 'super-safe' Loading Loading @@ -82,6 +88,9 @@ class Config(object): UPLOAD_FOLDER = os.getenv('PORTAL_UPLOAD_FOLDER', f"{PORTAL_STORAGE_BASE_DIR}/upload") GITPYTHON_CUSTOM_SSH_KEY = os.getenv('GITPYTHON_CUSTOM_SSH_KEY', None) # IS MUNI NOTES Integration IS_API_DOMAIN = os.getenv('IS_API_DOMAIN', None) class DevelopmentConfig(Config): """Development configuration Loading @@ -101,6 +110,7 @@ class ProductionConfig(Config): LOG_LEVEL_GLOBAL = os.getenv('LOG_LEVEL_GLOBAL', 'INFO') LOG_LEVEL_FILE = os.getenv('LOG_LEVEL_FILE', LOG_LEVEL_GLOBAL) LOG_LEVEL_CONSOLE = os.getenv('LOG_LEVEL_CONSOLE', LOG_LEVEL_GLOBAL) FLASK_ENV = os.getenv('FLASK_ENV', 'production') class TestConfig(Config): Loading @@ -109,6 +119,7 @@ class TestConfig(Config): SQLALCHEMY_TRACK_MODIFICATIONS = False TESTING = True ENV = 'development' FLASK_ENV = ENV DEBUG = False SQLALCHEMY_DATABASE_URI = 'sqlite://' # SQLALCHEMY_ECHO = True Loading @@ -133,7 +144,7 @@ class TestConfig(Config): GITLAB_KONTR_USERNAME = os.getenv('GITLAB_KONTR_USERNAME', 'admin') GIT_REPO_BASE = os.getenv('GIT_REPO_BASE', f"git@{GITLAB_BASE_DOMAIN}") GITLAB_URL = f'https://{GITLAB_BASE_DOMAIN}' FRONTEND_URL = os.getenv('FRONTEND_URL', 'http://localhost:4200') IS_API_DOMAIN = 'is.muni.local' # pylint: enable=too-few-public-methods Loading Loading
Pipfile.lock +3 −3 Original line number Diff line number Diff line Loading @@ -52,11 +52,11 @@ }, "authlib": { "hashes": [ "sha256:b61c6c6fd230c4ba8602fd85ee9a40e6dc859387699a1cd1f7247c4b109dcc17", "sha256:eda3e5af921a368091fef721d6d169bcff2aa0003d05113bc26e127f58c9a5e8" "sha256:3a226f231e962a16dd5f6fcf0c113235805ba206e294717a64fa8e04ae3ad9c4", "sha256:9741db6de2950a0a5cefbdb72ec7ab12f7e9fd530ff47219f1530e79183cbaaf" ], "index": "pypi", "version": "==0.10" "version": "==0.11" }, "billiard": { "hashes": [ Loading
management/data/data_test.py +5 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy from management.data.shared import DataFactory from portal.database.models import Review, Secret, Submission, SubmissionState from portal.database.models import Review, Secret, SubmissionState from portal.tools import time Loading @@ -23,8 +23,10 @@ def init_test_data(app: Flask, db: SQLAlchemy): lecturer1 = factory.create_user(username='lecturer1', name='Courses Owner', uco=1010) # courses test_course1 = factory.create_course(codename='testcourse1', name='Test Course One') test_course2 = factory.create_course(codename='testcourse2', name='test Course Two') test_course1 = factory.create_course(codename='testcourse1', name='Test Course One', faculty_id=100) test_course2 = factory.create_course(codename='testcourse2', name='test Course Two', faculty_id=100) # groups tc1_students = factory.create_group(course=test_course1, name="seminar01") Loading
management/data/shared.py +4 −1 Original line number Diff line number Diff line Loading @@ -129,12 +129,15 @@ class DataFactory: def create_worker(self, name: str, url: str) -> Worker: return self.__create_entity(Worker, name=name, url=url) def create_course(self, codename, name=None, token=None) -> Course: def create_course(self, codename, name=None, token=None, faculty_id=None) \ -> Course: name = name or codename desc = name + "'s description" course = self.__create_entity( Course, codename=codename, name=name, description=desc) course.notes_access_token = token or f"{codename}_token" if faculty_id is not None: course.faculty_id = faculty_id return course def create_group(self, course: Course, name: str) -> Group: Loading
portal/__init__.py +3 −4 Original line number Diff line number Diff line """ Main Portal module """ import logging import os from typing import Union Loading @@ -28,7 +28,7 @@ storage_wrapper = Storage() migrate = Migrate(db=db) ldap_wrapper = LDAPWrapper() is_api_factory = IsApiFactory() log = logger.get_logger(__name__) log = logging.getLogger(__name__) def configure_app(app: Flask, env: str = None, Loading Loading @@ -116,7 +116,7 @@ def create_app(environment: str = None): Returns(Flask): Flask application instance """ app = Flask('portal') app = Flask(__name__) # app configuration configure_app(app, env=environment) _log_config(app) Loading @@ -129,7 +129,6 @@ def create_app(environment: str = None): rest.gitlab.register_gitlab_app(app) rest.register_namespaces(app) return app Loading
portal/config.py +12 −1 Original line number Diff line number Diff line Loading @@ -22,10 +22,16 @@ log = logger.get_logger(__name__) class Config(object): """Base configuration """ ENV = os.getenv('ENV', 'development') FLASK_ENV = os.getenv('FLASK_ENV', ENV) # Base dirs PROJECT_ROOT = paths.ROOT_DIR APP_DIR = paths.ROOT_DIR / 'portal' # FRONTEND FRONTEND_URL = os.getenv('FRONTEND_URL', 'http://localhost:4200') # Secrets and JWT Config SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' JWT_SECRET_KEY = os.environ.get('JWT_SECRET_KEY') or 'super-safe' Loading Loading @@ -82,6 +88,9 @@ class Config(object): UPLOAD_FOLDER = os.getenv('PORTAL_UPLOAD_FOLDER', f"{PORTAL_STORAGE_BASE_DIR}/upload") GITPYTHON_CUSTOM_SSH_KEY = os.getenv('GITPYTHON_CUSTOM_SSH_KEY', None) # IS MUNI NOTES Integration IS_API_DOMAIN = os.getenv('IS_API_DOMAIN', None) class DevelopmentConfig(Config): """Development configuration Loading @@ -101,6 +110,7 @@ class ProductionConfig(Config): LOG_LEVEL_GLOBAL = os.getenv('LOG_LEVEL_GLOBAL', 'INFO') LOG_LEVEL_FILE = os.getenv('LOG_LEVEL_FILE', LOG_LEVEL_GLOBAL) LOG_LEVEL_CONSOLE = os.getenv('LOG_LEVEL_CONSOLE', LOG_LEVEL_GLOBAL) FLASK_ENV = os.getenv('FLASK_ENV', 'production') class TestConfig(Config): Loading @@ -109,6 +119,7 @@ class TestConfig(Config): SQLALCHEMY_TRACK_MODIFICATIONS = False TESTING = True ENV = 'development' FLASK_ENV = ENV DEBUG = False SQLALCHEMY_DATABASE_URI = 'sqlite://' # SQLALCHEMY_ECHO = True Loading @@ -133,7 +144,7 @@ class TestConfig(Config): GITLAB_KONTR_USERNAME = os.getenv('GITLAB_KONTR_USERNAME', 'admin') GIT_REPO_BASE = os.getenv('GIT_REPO_BASE', f"git@{GITLAB_BASE_DOMAIN}") GITLAB_URL = f'https://{GITLAB_BASE_DOMAIN}' FRONTEND_URL = os.getenv('FRONTEND_URL', 'http://localhost:4200') IS_API_DOMAIN = 'is.muni.local' # pylint: enable=too-few-public-methods Loading