mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2025-12-30 15:49:44 -06:00
29 lines
943 B
Python
29 lines
943 B
Python
import pytest
|
|
from flask import url_for
|
|
|
|
from app.models import Settings, User
|
|
from app import db
|
|
|
|
|
|
class TestSystemUiFlags:
|
|
def test_calendar_hidden_when_system_disabled(self, client, user):
|
|
"""If calendar is disabled system-wide, it should not appear in nav or user settings."""
|
|
# Disable calendar system-wide
|
|
settings = Settings.get_settings()
|
|
settings.ui_allow_calendar = False
|
|
db.session.commit()
|
|
|
|
# Log in
|
|
with client.session_transaction() as sess:
|
|
sess["_user_id"] = str(user.id)
|
|
|
|
# Settings page should not contain the calendar checkbox
|
|
resp = client.get("/settings")
|
|
data = resp.data.decode("utf-8")
|
|
assert "ui_show_calendar" not in data
|
|
|
|
# Sidebar nav should not show Calendar section label
|
|
resp = client.get(url_for("main.dashboard"))
|
|
nav = resp.data.decode("utf-8")
|
|
assert "Calendar" not in nav
|