Commit graph

108 commits

Author SHA1 Message Date
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
Ankush Menat
cbe816347e
Merge pull request #22017 from GursheenK/implement-like-in-compare-util
feat: implement like in compare util
2023-08-11 22:16:12 +05:30
Ankush Menat
7a5a0c27a2 fix: Support SQL like LIKE filter
Other changes:
- Ignore empty doctype in filter creator
- Simplified recorder filter evals
2023-08-11 21:24:38 +05:30
Gursheen Anand
b019a1163c feat: implement like & not like in compare util 2023-08-11 15:34:07 +05:30
Ankush Menat
a1f3114305
fix: sanitize frappe._dicts too in TB sanitizer (#22012) 2023-08-11 12:25:40 +05:30
gavin
faab26ce4f
Merge branch 'develop' into bump-pydantic-v2 2023-06-26 13:12:24 +05:30
Ankush Menat
b3840596fc
test: mock github API calls (#21450)
[skip ci]
2023-06-21 16:33:09 +05:30
Smit Vora
db6a06d204
fix: make sure number is not zero for bankers_rounding (#21431)
* fix: make sure num is not zero for bankers_rounding

* test: rounding near zero

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-06-20 12:00:22 +05:30
Gavin D'souza
ae3a61b3fc
test: Add tests for Document arg validations 2023-06-07 19:26:32 +05:30
Gavin D'souza
5c2fe7c292
test: Add tests for validate_argument_types decorator 2023-06-07 17:17:13 +05:30
barredterra
44bb745035 fix: change pretty date expectations in test 2023-04-11 15:56:05 +02:00
Ankush Menat
dd2ac72a9a fix: skip 0 for rounding 2023-03-13 14:16:39 +05:30
Ankush Menat
709edf1f55 fix: Make corrected bankers rounding default method 2023-03-13 13:10:51 +05:30
Ankush Menat
139d4a87b4 fix: corrected banker's rounding
closes https://github.com/frappe/frappe/issues/19570
2023-03-13 12:30:48 +05:30
Ankush Menat
97ca92e3d1
refactor: change rounding method names (#20299)
These are easy to understand.

Added third method for corrected banker's rounding.
2023-03-10 14:57:15 +05:30
Ankush Menat
68d8a8eadd feat: implement custom rounding in JS 2023-03-08 12:13:42 +05:30
Ankush Menat
86b9ff4266 feat: Allow specifying rounding method in flt 2023-03-08 10:59:02 +05:30
Ankush Menat
48f63f53ab feat: configurable rounding methods 2023-03-08 10:44:44 +05:30
Ritwik Puri
e7f28b08c9
fix: cast primary value in compare util if fieldtype is present (#20092)
* fix: cast primary value in compare util if fieldtype is present

* test: add test for date & datetime filters when using evaluate_filters
2023-02-28 16:50:52 +05:30
Ankush Menat
cd4d601ed4 fix: traceback sanitizer got extra positional args 2023-02-15 17:51:21 +05:30
Ankush Menat
70ee9272b1
fix: sanitize traceback for common secrets (#19805) 2023-01-27 12:44:33 +05:30
Ankush Menat
e31db5d502
fix: handle tel: links in emails (#19635) 2023-01-17 20:31:06 +05:30