diff --git a/pyproject.toml b/pyproject.toml index b6e50e4..4c3cbfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,3 +48,9 @@ exclude = [ "**/migrations", "**/_reportlab.py", "**/tests.py"] typeCheckingMode = "standard" deprecateTypingAliases = true pythonVersion = "3.13" + +[tool.coverage.run] +branch = true +source = [ + "src", +] \ No newline at end of file diff --git a/requirements/dev.txt b/requirements/dev.txt index a9381ae..f2623a8 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -22,7 +22,7 @@ django==5.2.8 # via # django-telegram-app # ida (pyproject.toml) -django-telegram-app==0.2.0 +django-telegram-app==0.3.0 # via ida (pyproject.toml) django-types==0.22.0 # via ida (pyproject.toml) diff --git a/requirements/main.txt b/requirements/main.txt index fea9fcc..18f32ac 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -16,7 +16,7 @@ django==5.2.8 # via # django-telegram-app # ida (pyproject.toml) -django-telegram-app==0.2.0 +django-telegram-app==0.3.0 # via ida (pyproject.toml) envyronment==0.4.0 # via ida (pyproject.toml) diff --git a/src/apps/timesheets/management/commands/startcompletetimesheet.py b/src/apps/timesheets/management/commands/startcompletetimesheet.py index c7b8892..85435ec 100644 --- a/src/apps/timesheets/management/commands/startcompletetimesheet.py +++ b/src/apps/timesheets/management/commands/startcompletetimesheet.py @@ -3,12 +3,14 @@ from django.utils import timezone from django_telegram_app.management.base import BaseTelegramCommand +from apps.timesheets.telegrambot.commands.completetimesheet import Command as CompleteTimesheetCommand + class Command(BaseTelegramCommand): """Start the CompleteTimesheet command.""" help = "Start the CompleteTimesheet command to let users complete their timesheets." - command_text = "/completetimesheet" + command = CompleteTimesheetCommand def should_run(self): """Only run the command if it's the last day of the month.""" diff --git a/src/apps/timesheets/management/commands/startregisterwork.py b/src/apps/timesheets/management/commands/startregisterwork.py index dd413f0..389453c 100644 --- a/src/apps/timesheets/management/commands/startregisterwork.py +++ b/src/apps/timesheets/management/commands/startregisterwork.py @@ -3,12 +3,14 @@ from django.utils import timezone from django_telegram_app.management.base import BaseTelegramCommand +from apps.timesheets.telegrambot.commands.registerwork import Command as RegisterWorkCommand + class Command(BaseTelegramCommand): """Start a RegisterWork command.""" help = "Start a RegisterWork command to let users register their work hours." - command_text = "/registerwork" + command = RegisterWorkCommand def should_run(self): """Only run on weekdays.""" diff --git a/src/apps/timesheets/tests.py b/src/apps/timesheets/tests.py index 1beb6df..70f8885 100644 --- a/src/apps/timesheets/tests.py +++ b/src/apps/timesheets/tests.py @@ -8,9 +8,9 @@ from django.core.exceptions import ValidationError from django.core.management import call_command from django.test import TestCase +from django_telegram_app import get_telegram_settings_model from django_telegram_app.bot import get_commands, load_command_class from django_telegram_app.bot.testing.testcases import TelegramBotTestCase -from django_telegram_app.resolver import get_telegram_settings_model from apps.projects.models import Project from apps.timesheets.models import TimeRangeItemTypeRule, Timesheet, TimesheetItem, WeekdayItemTypeRule @@ -129,7 +129,6 @@ class TimesheetsTelegramBotTestCase(TelegramBotTestCase): @classmethod def setUpTestData(cls): """Set up the test data.""" - super().setUpTestData() cls.timesheet = Timesheet.objects.get(pk=1) cls.user = get_user_model().objects.get(pk=1) cls.project = Project.objects.get(pk=1)