diff --git a/app/routes/admin_panel_comments.py b/app/routes/admin_panel_comments.py index 36e453b6d..976ef97d9 100755 --- a/app/routes/admin_panel_comments.py +++ b/app/routes/admin_panel_comments.py @@ -14,7 +14,6 @@ @admin_panel_comments_blueprint.route("/admin/comments", methods=["GET", "POST"]) -@admin_panel_comments_blueprint.route("/admin-panel/comments", methods=["GET", "POST"]) def admin_panel_comments(): if "username" in session: Log.info(f"Admin: {session['username']} reached to comments admin panel") diff --git a/app/routes/admin_panel_posts.py b/app/routes/admin_panel_posts.py index 1fbfb1a9a..88c237ea2 100755 --- a/app/routes/admin_panel_posts.py +++ b/app/routes/admin_panel_posts.py @@ -14,7 +14,6 @@ @admin_panel_posts_blueprint.route("/admin/posts", methods=["GET", "POST"]) -@admin_panel_posts_blueprint.route("/admin-panel/posts", methods=["GET", "POST"]) def admin_panel_posts(): if "username" in session: Log.info(f"Admin: {session['username']} reached to posts admin panel") diff --git a/app/routes/admin_panel_users.py b/app/routes/admin_panel_users.py index 667f57b30..738d0530f 100755 --- a/app/routes/admin_panel_users.py +++ b/app/routes/admin_panel_users.py @@ -16,7 +16,6 @@ @admin_panel_users_blueprint.route("/admin/users", methods=["GET", "POST"]) -@admin_panel_users_blueprint.route("/admin-panel/users", methods=["GET", "POST"]) def admin_panel_users(): if "username" in session: Log.info(f"Admin: {session['username']} reached to users admin panel") diff --git a/app/settings.py b/app/settings.py index 6a4750629..07ad5997e 100755 --- a/app/settings.py +++ b/app/settings.py @@ -36,7 +36,6 @@ class Settings: LOG_FOLDER_ROOT (str): Root path of the log folder. LOG_FILE_ROOT (str): Root path of the log file. LOG_JSON_ROOT (str): Root path of the log JSON file. - BREAKER_TEXT (str): Separator text used in log files. APP_SECRET_KEY (str): Secret key for Flask sessions. SESSION_PERMANENT (bool): Toggle permanent sessions for the Flask application. DB_FOLDER_ROOT (str): Root path of the database folder. @@ -120,8 +119,6 @@ class Settings: LOG_FOLDER_ROOT = os.environ.get("LOG_FOLDER_ROOT", "log/") LOG_FILE_ROOT = LOG_FOLDER_ROOT + "log.log" LOG_JSON_ROOT = LOG_FOLDER_ROOT + "log.json" - BREAKER_TEXT = "\n" - # Session Configuration APP_SECRET_KEY = os.environ.get("APP_SECRET_KEY", secrets.token_urlsafe(32)) SESSION_PERMANENT = _bool(os.environ.get("SESSION_PERMANENT", "True")) diff --git a/app/static/js/post_config.js b/app/static/js/post_config.js deleted file mode 100644 index 8c9314eb3..000000000 --- a/app/static/js/post_config.js +++ /dev/null @@ -1,2 +0,0 @@ -// Post Configuration Variables -// This file is loaded dynamically with template variables injected \ No newline at end of file diff --git a/app/utils/context_processor/return_post_url_id.py b/app/utils/context_processor/return_post_url_id.py index ba59e4fad..d4c1d123a 100644 --- a/app/utils/context_processor/return_post_url_id.py +++ b/app/utils/context_processor/return_post_url_id.py @@ -2,7 +2,7 @@ def return_post_url_id(): - def url_id(title, content): - return get_post_url_id_from_post(title, content) + def url_id(post_id): + return get_post_url_id_from_post(post_id) return dict(url_id=url_id) diff --git a/app/utils/time.py b/app/utils/time.py index 0902b5f18..2449e64fe 100644 --- a/app/utils/time.py +++ b/app/utils/time.py @@ -3,34 +3,6 @@ """ from datetime import datetime -from time import tzname - - -def current_time_zone(): - """ - Returns the current system time zone as a string. - """ - return tzname[0] - - -def current_date(): - """ - Returns the current date as a string in the format "dd.mm.yy". - """ - return datetime.now().strftime("%d.%m.%y") - - -def current_time(seconds=False, micro_seconds=False): - """ - Returns the current time as a string in the format "HH:MM" or "HH:MM:SS" depending on the value of the seconds parameter. If the micro_seconds parameter is set to True, the time will include microseconds as well. - """ - if not seconds: - return datetime.now().strftime("%H:%M") - else: - if micro_seconds: - return datetime.now().strftime("%H:%M:%S.%f") - else: - return datetime.now().strftime("%H:%M:%S") def current_time_stamp(): diff --git a/tests/e2e/helpers/__init__.py b/tests/e2e/helpers/__init__.py index d233214c7..06ae7fb75 100644 --- a/tests/e2e/helpers/__init__.py +++ b/tests/e2e/helpers/__init__.py @@ -4,12 +4,11 @@ create_test_user, get_user_by_username, ) -from tests.e2e.helpers.test_data import UserData, PostData +from tests.e2e.helpers.test_data import UserData __all__ = [ "reset_database", "create_test_user", "get_user_by_username", "UserData", - "PostData", ] diff --git a/tests/e2e/helpers/database_helpers.py b/tests/e2e/helpers/database_helpers.py index e159812a3..6c727d924 100644 --- a/tests/e2e/helpers/database_helpers.py +++ b/tests/e2e/helpers/database_helpers.py @@ -105,41 +105,6 @@ def get_user_by_username(db_path: str, username: str) -> dict | None: conn.close() -def delete_user(db_path: str, username: str) -> bool: - """ - Delete a user by username. - Returns True if user was deleted, False if not found. - """ - conn = get_db_connection(db_path) - cursor = conn.cursor() - - try: - cursor.execute( - "DELETE FROM users WHERE LOWER(username) = LOWER(?)", (username,) - ) - conn.commit() - return cursor.rowcount > 0 - finally: - conn.close() - - -def user_exists(db_path: str, username: str) -> bool: - """Check if a user exists by username.""" - return get_user_by_username(db_path, username) is not None - - -def get_user_count(db_path: str) -> int: - """Get the total number of users in the database.""" - conn = get_db_connection(db_path) - cursor = conn.cursor() - - try: - cursor.execute("SELECT COUNT(*) FROM users") - return cursor.fetchone()[0] - finally: - conn.close() - - def get_user_by_email(db_path: str, email: str) -> dict | None: """ Get user data by email. @@ -172,8 +137,3 @@ def get_user_points(db_path: str, username: str) -> int | None: if user: return user.get("points", 0) return None - - -def email_exists(db_path: str, email: str) -> bool: - """Check if an email exists in the database.""" - return get_user_by_email(db_path, email) is not None diff --git a/tests/e2e/helpers/test_data.py b/tests/e2e/helpers/test_data.py index 0123d7c0a..1706f86f6 100644 --- a/tests/e2e/helpers/test_data.py +++ b/tests/e2e/helpers/test_data.py @@ -21,62 +21,7 @@ def generate(cls, **overrides) -> "UserData": """Generate test user data with optional overrides.""" return cls(**overrides) - @classmethod - def admin(cls) -> "UserData": - """Generate admin user data.""" - return cls( - username=f"testadmin_{uuid.uuid4().hex[:8]}", - email=f"admin_{uuid.uuid4().hex[:8]}@test.com", - role="admin", - ) - @classmethod def unverified(cls) -> "UserData": """Generate unverified user data.""" return cls(is_verified="False") - - -@dataclass -class PostData: - """Test post data with default values.""" - - title: str = field(default_factory=lambda: f"Test Post {uuid.uuid4().hex[:8]}") - content: str = "This is test content for the post." - category: str = "test" - tags: str = "test,automation" - abstract: str = "Test post abstract" - url_id: str = field(default_factory=lambda: f"test-post-{uuid.uuid4().hex[:8]}") - author: str = "admin" - - @classmethod - def generate(cls, **overrides) -> "PostData": - """Generate test post data with optional overrides.""" - return cls(**overrides) - - -# Invalid username test cases -INVALID_USERNAMES = [ - "", # Empty - " ", # Whitespace only - "a" * 256, # Too long - "user@name", # Invalid character - "user