Commit graph

8 commits

Author SHA1 Message Date
Ashwin
dd6ca2958d Add unit tests for organization admin checks and saved views provider
- Implement tests for `isOrgAdminProvider` to validate admin roles based on organization membership and role.
- Create tests for `saved_views_provider` to ensure correct API interactions for saving, renaming, and deleting saved views.
- Enhance ticket tree tests to accurately reflect inactive and merged ticket handling.
- Update CSV import tests to verify error handling and file saving functionality.
- Introduce tests for deal cards to ensure correct display of next steps and task statuses.
2026-09-26 20:38:32 +05:30
Ashwin
f30e30aa7e feat(tags): add merge functionality for tags
- Introduced TagsMergeView to handle merging of tags, allowing records from one tag to be moved to another and archiving the source tag.
- Updated URLs to include the new merge endpoint.
- Enhanced tag views and serializers to support merging operations.
- Added tests for the new merge functionality, ensuring proper behavior and error handling.
- Updated frontend to integrate the merge feature, including UI changes for suggesting tag merges and handling user interactions.
- Documented the merge functionality in the relevant API and frontend files.
2026-08-07 16:43:34 +05:30
Ashwin
6a7e821eed Refactor import views and enhance comment authorization
- Updated `_read_upload` function to enforce file size limit based on actual bytes read instead of client-supplied Content-Length, preventing potential bypasses.
- Added comprehensive tests for import size cap to ensure proper enforcement against various client declarations.
- Introduced `test_approval_authz.py` to validate approval visibility based on case access rules, ensuring unauthorized members cannot view sensitive case information.
- Modified `CommentSerializer` to make `object_id` and `org` read-only, preventing unauthorized edits to comment targets and ownership.
- Enhanced lead import functionality to restrict access to admin and users with sales access, ensuring proper authorization for bulk lead creation.
- Updated task handling in `create_lead_from_file` to correctly impersonate the user during lead creation, preserving the audit trail.
- Added tests for lead upload functionality to verify proper handling of CSV imports, including checks for duplicate titles across organizations and handling of missing email fields.
2026-08-05 06:00:06 +05:30
Ashwin
e3b5181b19 Refactor comments for clarity and consistency across multiple screens and services
- Updated comments in LeadsListScreen, MoreScreen, TaskDetailScreen, TaskFormScreen, TasksListScreen, TicketAnalyticsScreen, TicketDetailScreen, TicketsListScreen, ApiService, AuthService, CrashReporting, DealCard, TicketCard, MultiSelectSheet, KanbanColumn, StageStepper, TicketApprovalPanel, TicketPropertiesCard, and TicketTimePanel to improve readability and maintain a consistent style.
- Adjusted punctuation and phrasing for better flow and understanding.
2026-08-03 09:36:48 +05:30
Ashwin
c9250dda3a feat(accounts): add rollup calculations to AccountSerializer and annotate rollups in queryset; implement validation for annual revenue to prevent negative values; enhance access control for account-related views 2026-07-31 17:18:17 +05:30
ashwin31
16dd08f3ae fix: address CodeRabbit review feedback
Production fixes:
- Add org filter to comments query in user_views.py
- Pass org/created_by to default BoardColumn creation in board_views.py
- Add null checks to opportunity delete/patch methods
- Use get_object_or_404 with org filter in task_views.py post method
- Inspect IntegrityError message before assuming email constraint in lead_views.py
- Fix OpportunityLineItem.__str__ to use name field when product is None
- Add permissions: contents: write to CI workflow for badge push
- Align @types/node to v24 to match CI Node version

Test cleanup:
- Remove unused variables (email, qs, li1, task assignments, BytesIO import)
- Rename ambiguous variable l to lead in leads tests
- Rename misleading test_for_org_filters_correctly to test_org_scoped_classes_instantiate
- Add _set_rls helper to test_tasks_kanban.py for PostgreSQL compatibility
- Update test_str_no_product to expect correct behavior after __str__ fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 23:22:17 +05:30
ashwin31
9e35486fd3 test: expand backend test suite to 1229 tests with 93% coverage
Scale up from 193 tests (62% coverage) to 1229 tests (93% coverage)
targeting all uncovered view logic, model methods, serializers, and
utility code across all 8 app modules. Added new test files for
duplicate detection, external auth, audit logging, models, dashboard,
organizations, and settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 16:58:52 +05:30
ashwin31
de74dc56cc feat: add comprehensive backend API test suite with 193 tests and CI
Add pytest-based test infrastructure with SQLite for fast isolated testing.
Tests cover all 8 app modules (common, accounts, leads, contacts, opportunity,
cases, tasks, invoices) including CRUD, org isolation, kanban, comments, and
auth endpoints. Achieves 54% coverage with a 50% threshold.

Also fixes 10 backend bugs discovered by the test suite:
- Fix serializer read_only_fields for org (teams, documents, board columns/tasks)
- Fix AccountCommentView.put missing partial=True
- Fix UserDetailView broken reverse relation and missing org on address save
- Fix DocumentDetailView.put partial update and null status bug
- Fix TaskDetailView unhandled DoesNotExist → get_object_or_404
- Fix BoardColumn/BoardTask views missing org on save
- Fix LeadListView.post unhandled IntegrityError for duplicate email
- Fix ContactDetailView.get wrong reverse relation name
- Fix OpportunityDetailView null checks before accessing .org

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:52:42 +05:30