Commit graph

65 commits

Author SHA1 Message Date
Ejaaz Khan
3f5b192326 test: add test for not equal none condition 2025-09-30 14:55:44 +05:30
Soham Kulkarni
64db88228f
refactor: seperate blogs into a seperate app (#32737)
* fix: remove doctypes,workspace blocks, files

* fix: minor python tests and UI tests

* fix: remove blog post from tests

* fix: remove blogger as role for tests

* fix: add check for if doctype exists

* fix: ui test

* fix: more cleanup

* fix: cleanup comments and fix test_query

* fix: resolve conflicts

* fix: add warning and handle comments
2025-07-28 14:35:02 +05:30
Sagar Vora
8b13971ab2 test: use contextmanager to set user 2025-06-27 14:51:26 +05:30
Faris Ansari
f2a0724f9a feat: add back sql functions support with json syntax
```
fields=['user_type', {'COUNT': 'name', 'as': 'total'}]
fields=[{"IFNULL": ["first_name", "'Unknown'"], "as": "safe_name"}]
```
2025-06-18 16:15:25 +05:30
Faris Ansari
840e7991ce fix: dont allow partial backticks
- add tests
2025-06-18 16:14:32 +05:30
Faris Ansari
3f65806a0b fix: harden group by and order by inputs
- only field, link_field.field, child_field.field allowed
- dont allow backticks
- add permlevel check
- add tests
2025-06-18 16:10:52 +05:30
Faris Ansari
420e891d96 feat: remove support for sql functions in fields 2025-06-18 16:10:52 +05:30
Faris Ansari
9a84f20436 feat: add support for nested AND and OR conditions 2025-06-18 16:10:52 +05:30
Faris Ansari
b2a37f86b3 fix: filtering should only be allowed on permitted fields 2025-06-18 16:00:22 +05:30
Faris Ansari
f77a940582 fix: check permlevel for fields like "link_field.fieldname" 2025-06-18 16:00:22 +05:30
Faris Ansari
63afc0601b fix: restrict child table access if user has only "select" on parent 2025-06-18 16:00:22 +05:30
Faris Ansari
a9fb29fb8e test: test for invalid inputs in fields, filters, group_by, order_by
- comment out invalid tests
2025-06-18 16:00:22 +05:30
Faris Ansari
39a65a1300 test: enable server script temporarily 2025-06-18 15:56:11 +05:30
Faris Ansari
601df8268f test: simpler assertions 2025-06-18 15:56:11 +05:30
Faris Ansari
a94c143314 fix: add support for permission query conditions 2025-06-18 15:56:11 +05:30
Faris Ansari
3ab0e8756f test: mandatory field 2025-06-18 15:56:11 +05:30
Faris Ansari
ccca6bffab test: add permissions tests for qb.get_query 2025-06-18 15:56:11 +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
Ankush Menat
071e269548 fix!: Switch to creation as default sort order 2024-03-27 11:18:28 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Sagar Vora
81d5160ac1 test: ensure stricter filters when validate_filters is passed 2023-05-31 14:16:52 +05:30
Sagar Vora
9f5a994f70 fix!: improved filter validation in Engine.get_query 2023-05-31 14:16:52 +05:30
Faris Ansari
7e7b1e024a test: for child query in qb.get_query 2023-05-08 18:55:11 +05:30
Faris Ansari
543458b473 fix: handle empty list as filters 2023-01-16 15:38:15 +05:30
Faris Ansari
5bc5ff100b test: tests for various filter options 2023-01-16 14:12:04 +05:30
Faris Ansari
b7c0ba1bea fix: allow dynamic fields in filters
e.g.,
`filters={'link.field': 'value'}`
`filters={'child.field': 'value'}`
2022-12-31 22:55:00 +05:30
Faris Ansari
7ca39a81bf fix: explicitly specifiy order 2022-12-31 22:18:07 +05:30
Faris Ansari
726fcfdb79 refactor: qb.engine
- simplify
- qb.engine.get_query -> qb.get_query
- qb.engine.build_conditions -> qb.get_query
2022-12-25 23:19:11 +05:30
phot0n
dfe62f2614 test: use double quotes for postgres query assertions 2022-11-03 12:50:38 +05:30
Aradhya
e1719fd30c feat: Added support for table_field.fieldname and tests 2022-11-03 03:56:59 +05:30
Aradhya
88d506864b refactor: consistent quries and better naming 2022-11-02 17:21:37 +05:30
Aradhya
97b0b743ae test: Updated tests for parenttype condition 2022-11-02 02:40:23 +05:30
Aradhya
5703303abb Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-11-01 13:45:11 +05:30
Ankush Menat
fec24632a9 style: format
[skip ci]
2022-11-01 13:36:37 +05:30
Aradhya Tripathi
5ed696cd3d
fix(qb): fixed implicit join for child tables (#18692)
* test: Added test for multiple joins
2022-11-01 11:25:02 +05:30
Aradhya
84c8cb8705 test: Added more tests 2022-10-31 19:16:00 +05:30
Aradhya
e6a281f19e refactor: better naming 2022-10-27 13:11:15 +05:30
Aradhya
6198177ec6 test: Added tests for ancestors 2022-10-27 12:58:17 +05:30
Aradhya
15db8228f4 fix: adding additional conditions 2022-10-26 15:58:24 +05:30
Aradhya
7d18d5f519 test: Added tests for nested set queries 2022-10-25 20:42:33 +05:30
Aradhya Tripathi
457de5c6b3
fix: stripping comments sent to the database API (#18229)
* feat: stripping comments sent to the database API

* test: Added tests for comment stripping

* fix: only stripping comments in string fields

* refactor: removing on the fly mutations

* refactor: added helper to avoid mutations

* refactor: simplify sanitization

* refactor: removing indexing from everywhere

* refactor: readable functions

* test: only run mdb test on mdb

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-10-12 16:36:55 +05:30
Aradhya Tripathi
e73ae6f039
Merge branch 'develop' into get-all-mod 2022-08-19 15:42:35 +05:30
Aradhya
0addffafb9 refactor: minor changes 2022-08-17 19:52:51 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Aradhya
4d41465dc3 test: updated to run tests on maria db only 2022-08-14 14:57:04 +05:30
Aradhya
85d1e41738 fix: fixed join query from fields 2022-08-10 23:42:01 +05:30
Aradhya
6c905233c5 feat: Added support for string filters in query 2022-07-28 23:55:58 +05:30
Aradhya
1ae3b7f16b feat: Added support for fields in Locate 2022-07-27 21:22:38 +05:30
Aradhya
8624afdf6c test: Added tests for "`" in alias name 2022-07-27 18:39:31 +05:30
Aradhya
41f62ba0d2 fix: converting back to capitalized doctype names 2022-07-26 19:33:45 +05:30