Commit graph

129 commits

Author SHA1 Message Date
Kaushal Shriwas
ec8b3d9187 test: shorten safe filters test names 2026-04-30 19:34:14 +05:30
Kaushal Shriwas
8ade4ce27d fix: preserve numeric-shaped docnames without losing JSON parsing of scalars 2026-04-30 15:28:55 +05:30
Kaushal Shriwas
470964015e fix: also parse JSON-encoded scalar strings in get_safe_filters 2026-04-30 15:10:13 +05:30
Kaushal Shriwas
ff83bb1473 fix: preserve docnames matching scientific notation in get_safe_filters 2026-04-30 13:15:04 +05:30
Ankush Menat
657b1eb50c
fix!: Restrict allowed HTML in msgprints (#37399)
Co-authored-by: AarDG10 <aarol.dsouza@gmail.com>
2026-02-23 11:49:15 +00:00
Ankush Menat
c9cdacb4ce
feat: Optionally force type checking on whitelisted methods (#36744) 2026-02-05 16:20:41 +05:30
Alex Leach
8a82699640
fix(tests): Update more tests to conform with nh3 behaviour 2026-01-04 00:52:14 +00:00
Akhil Narang
8723a2b6ee
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-22 21:06:48 +05:30
sokumon
dd2dc053ca chore: more renames to /desk 2025-12-18 20:45:04 +05:30
Hardik Zinzuvadiya
b5f22227ab feat(utils): replace custom email parsing with RFC-compliant validation (fixes #27337)
Replaced the old comma-split based email parsing with `email.utils.getaddresses`
to correctly handle RFC 5322 formatted addresses, including display names
containing commas (e.g. `"Last, First" <email@example.com>`).

The previous implementation incorrectly split on commas and treated parts of
display names as standalone emails, causing valid inputs to fail validation and
breaking Communication creation (e.g. `"Gritton, Howard" <hgrit@example.com>`).

The new validator:
- correctly parses display names with commas
- handles multiple addresses and multiline input
- skips undisclosed recipients
- preserves existing EMAIL_MATCH_PATTERN validation
- returns only the email addresses (same as before)

Added additional test cases covering RFC-compliant inputs and empty-addr scenarios.
Fixes frappe/frappe#27337.
2025-12-07 06:38:12 +00:00
Sagar Vora
9a3e6c0275 test: move import to global 2025-11-21 17:07:23 +05:30
Sagar Vora
eac218216b test: use validate_argument_types directly in test fixtures
Use validate_argument_types decorator directly instead of frappe.whitelist()
for testing type validation behavior, avoiding unnecessary whitelisting.
2025-11-21 16:52:34 +05:30
Ejaaz Khan
27ce9a3df4
Merge pull request #34624 from khushi8112/get-link-to-report-between-condition
fix: handle between condition properly in get_link_to_report filters
2025-11-06 17:29:02 +05:30
khushi8112
fc52a5ce1a test: add test case for between condition 2025-11-06 16:30:57 +05:30
daniel.radl
45a0471f5c fix(utils): added format_duration test 2025-10-25 17:16:15 +00:00
Akhil Narang
355d218f8e
Merge pull request #34162 from akhilnarang/bump-ruff
refactor(treewide): bump ruff
2025-09-26 17:44:11 +05:30
Akhil Narang
6ca4d4d167
refactor(treewide): ruff format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-09-26 13:16:43 +05:30
Raffael Meyer
878c089679
fix: special operators in compare util (#34145) 2025-09-25 20:45:29 +02:00
Raffael Meyer
3c0a378a41
refactor: prefer list patterns provided by babel (#33857)
* feat: prefer list patterns provided by babel

* test: comma_and, comma_or
2025-09-04 15:17:56 +05:30
barredterra
b1c7821911 feat: validate IBAN in backend 2025-08-29 15:21:56 +02:00
Soham Kulkarni
0e46eb6228
fix: handle fraction units being zero (#33137)
* fix: handle fraction units being zero

* Revert "fix: handle fraction units being zero"

This reverts commit 912a031b16fb1e1951093d5b384976f4dc2968e6.

* fix: remove bad fallbacks from money_in_words

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-07-01 11:56:42 +05:30
sokumon
2b8d21d483 fix: add utm utils back 2025-06-24 18:43:28 +05:30
sokumon
6be013804d fix: remove tests utils and workspace card 2025-06-18 16:23:36 +05:30
Sagar Vora
b3e1eda4c8
feat: global frappe.in_test flag (#32960)
* feat: global `frappe.in_test` flag

* feat: helper utility to toggle `frappe.in_test`

* fix: use `toggle_test_mode` util

* fix: use `frappe.in_test`

* chore: add comment explaining global `in_test`

* chore: ignore commit replacing flag usage

* test: temporarily disable `frappe.in_test`

this worked earlier because flag was set in werkzeug.local which was separate for API test client

* test: add comment explaining change
2025-06-17 19:19:31 +05:30
Raffael Meyer
fed66a32ed
fix: support "Timespan" in evaluate_filters (#31190)
* fix: support "Timespan" in `evaluate_filters`

* fix: add None case
2025-03-13 12:51:49 +01:00
Ankush Menat
17d6d81fb5
feat: mini pretty dates (#31331)
Narrow format pretty dates for list views, works the same way as client
side function.
2025-02-20 05:18:45 +00:00
Ankush Menat
ba6e3f6cd1 test: igore edge case of invalid strings
We parse them as None instead of 1-1-1 etc
2025-01-15 12:07:06 +05:30
Ankush Menat
c72e91f465
fix: backward compatible date parsing (#29155)
Even though we never use tz aware object in frappe this function
previously used to retain them, so keep TZinfo for sake of compat.

Nothing should be affected ideally.
2025-01-14 11:05:55 +00:00
Ankush Menat
1c2f8abb4e
perf: speedup get_datetime by ~9.5x (#28840) 2024-12-19 20:01:45 +05:30
Akhil Narang
94fe90de66
refactor: pytz -> ZoneInfo
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-06 16:14:05 +05:30
David Arnold
c114e5fae8
refactor: unit vs integration treewide (#27992)
* refactor: constitute unit test case

* fix: docs and type hints

* refactor: mark presumed integration test cases explicitly

At time of writing, we now have at least two base test classes:

- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase

They load in their perspective priority queue during execution.

Probably more to come for more efficient queing and scheduling.

In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.

* feat: Move test-related functions from test_runner.py to tests/utils.py

* refactor: add bare UnitTestCase to all doctype tests

This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
2024-10-06 09:43:36 +00:00
Raffael Meyer
d3248612cb
fix: money in words (#27190) 2024-09-21 16:24:39 +02:00
David (aider)
7e66c2be50
feat: add unit tests for URL tracker functions 2024-09-12 00:08:11 +02:00
Ankush Menat
e0c171b23b feat: show security issues count
chore: conflicts
2024-05-04 15:08:34 +05:30
Ankush Menat
5ca14bb171 feat: FC specific update notifications 2024-05-04 15:08:34 +05:30
Rohan
4bfcccfd11
fix: ignore unittest.mock objects during typing validations (#26301)
* fix: ignore unittest.mock objects during typing validations

* fix: check against base mock class

---------

Co-authored-by: Rohan Bansal <rohan@agritheory.dev>
2024-05-02 11:00:02 +00:00
Ankush Menat
ea5e1b61ad
fix: cint -> avoid precision loss if already integer (#25735) 2024-03-29 22:31:53 +05:30
Ankush Menat
672f3b2258 refactor!: sort by creation for clearing old logs 2024-03-27 13:04:01 +05:30
Maxim Sysoev
eff50e1cd3
fix: filter Implementation is set operator (#25182)
* Implementation is set operator. fix issue #25180

* Refactored filtrer operator `is`,
Add tests

* fix: Correct implementation for `is set`

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2024-03-02 13:59:30 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
scdanieli
a1cb19c820 fix: ensure has_value_changed works for datetime, date and timedelta fields 2024-02-18 16:05:31 +01:00
Ankush Menat
4c925e0325 refactor: Reset password flow
- Hash one time reset tokens instead of storing them as is
- Up the perm level
- Use better source of randomness for generating token
- minor code cleanup here and there
2024-02-11 14:25:26 +05:30
Raffael Meyer
b3b02c809f
Merge pull request #24684 from barredterra/label-in-link-to-form 2024-02-09 21:03:07 +01:00
Ankush Menat
ef923e4cc9 test: use known functions for testing
Random functions can have annotations but no annotations on arguments
2024-02-09 17:11:48 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
barredterra
0184aa7823 test: get_url_to_form 2024-02-06 12:50:01 +01:00
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
barredterra
b5c48255e1 test: check latest github release 2024-01-14 16:46:34 +01:00
Sambasiva Suda
7165f94148
fix: validate_email_addr should return email id as it is if it is valid (#22613) 2023-10-11 12:37:48 +05:30
David Arnold
414febab96
fix(test): ensure tests construe the site url from its constructor 2023-08-23 12:04:57 +02:00