Files
TimeTracker/tests/test_new_features.py
Dries Peeters 79e826ced2 feat(tasks,ui): enhance task management UI; update routes; add tests
Improve task workflows and overall UX, and align backend routes with the
new UI flows. Update docs and development setup accordingly.

- UI: refine task list/view/edit templates, project views, and Kanban
  partial (`_kanban_tailwind.html`)
- CSS: polish `app/static/enhanced-ui.css` for spacing, layout, and
  responsiveness
- Routes: update `app/routes/tasks.py` and `app/routes/clients.py` to
  support new edit/delete/filter behaviors and validations
- Templates: align clients/projects pages for consistency and navigation
- Docs: refresh `docs/GETTING_STARTED.md` and
  `docs/TASK_MANAGEMENT_README.md`
- Dev: adjust `docker-compose.yml` and `setup.py` to match the latest
  runtime/build expectations
- Tests: add coverage for delete actions, task project editing, and task
  filters UI (`tests/test_delete_actions.py`,
  `tests/test_task_edit_project.py`,
  `tests/test_tasks_filters_ui.py`); update existing tests

Why:
- Streamlines common task operations and improves discoverability
- Ensures backend and UI are consistent and well-tested
2025-10-21 17:05:00 +02:00

54 lines
1.6 KiB
Python

import pytest
from app import db
from app.models import Project, User, SavedFilter
@pytest.mark.smoke
@pytest.mark.api
def test_burndown_endpoint_available(client, app):
"""Test that burndown endpoint is available."""
# Minimal entities
u = User(username='admin')
u.role = 'admin'
u.is_active = True
db.session.add(u)
p = Project(name='X', client_id=1, billable=False)
db.session.add(p)
db.session.commit()
# Just ensure route exists; not full auth flow here
# This is a placeholder smoke test to be expanded in integration tests
assert True
@pytest.mark.smoke
@pytest.mark.models
def test_saved_filter_model_roundtrip(app):
"""Test that SavedFilter can be created and serialized."""
# Ensure SavedFilter can be created and serialized
sf = SavedFilter(user_id=1, name='My Filter', scope='time', payload={'project_id': 1, 'tag': 'deep'})
db.session.add(sf)
db.session.commit()
as_dict = sf.to_dict()
assert as_dict['name'] == 'My Filter'
assert as_dict['scope'] == 'time'
@pytest.mark.api
@pytest.mark.integration
def test_inline_client_creation_json_flow(admin_authenticated_client):
"""Creating a client via AJAX JSON should return 201 and client payload."""
resp = admin_authenticated_client.post(
'/clients/create',
data={
'name': 'Inline Modal Client',
'default_hourly_rate': '123.45'
},
headers={'X-Requested-With': 'XMLHttpRequest'}
)
assert resp.status_code in (201, 400, 403)
if resp.status_code == 201:
data = resp.get_json()
assert data['name'] == 'Inline Modal Client'
assert data['id'] > 0