Commit graph

68 commits

Author SHA1 Message Date
sokumon
86db71f8fa feat: move /app to /desk 2025-11-14 23:05:13 +05:30
Suraj Shetty
4bec26bb90 test: Add test case to validate forward_query_parameters functionality 2025-10-06 13:18:59 +05:30
Ankush Menat
47a47a9b5d refactor!: Change internal datastructure of db.value_cache
It's now a defaultdictionary of `[doctype][name/filters][fieldname]`

This allows us to implement granular clearing and improve usage of this cache.
2025-06-05 14:46:03 +05:30
Ankush Menat
e4b0d11b19
fix: only show tracebacks to system users (#31629)
Website users by design are supposed to be "less trusted", so don't show
tracebacks to them.
2025-03-13 14:48:20 +05:30
Ankush Menat
b7ddd1df92 perf: cache hooks in client-side cache 2025-01-06 20:24:27 +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
72c2207e0f refactor: useless use of dict in frappe.get_doc 2024-02-10 12:52:38 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Akhil Narang
ff4dca3e16
fix(redirect): make the status codes a select field instead of int
Drop mandatory, assume sane defaults
The current implementation broke old users of redirects like helpdesk app

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-22 12:25:41 +05:30
Akhil Narang
2224d86c94
refactor: cache status code as well
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-20 17:47:16 +05:30
Akhil Narang
c8816a8b6a
fix(tests): fix redirect tests by adding new field + add another test scenario
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-20 17:36:42 +05:30
Ankush Menat
d7a9d0111c
perf: lazy load SVG icons (#22517)
| Metric                             | Before | After | Change    |
| ---                                | ---    | ---   | ---       |
| app.html first response size       | 421kb  | 106kb | -75% (!)  |
| First response duration            | 60ms   | 40ms  | -33%      |

huge thanks to @cogk for doing most of the work for this PR on this issue: https://github.com/frappe/frappe/issues/17449#issuecomment-1728328726

Co-authored-by: Corentin Flr <10946971+cogk@users.noreply.github.com>
2023-09-23 15:13:43 +05:30
Corentin Flr
41d30e7213
feat: Add custom icons with the app_include_icons hook (#22254)
* feat: Add custom icons with the `app_include_icons` hook

These custom icons are available on the desk only. They can be picked in the `ControlIcon` picker.

Co-authored-by: Abraham Kalungi <85731451+kalungia@users.noreply.github.com>

* fix: skip conf for including icons

* test: Fix test_include_icons

---------

Co-authored-by: Abraham Kalungi <85731451+kalungia@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-09-20 20:23:17 +05:30
Deepesh Garg
e38078a69f
test: Patch hooks for testing (#21702)
* test: Patch hooks for testing

* test: hooks patcher

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-07-17 12:41:27 +05:30
Corentin Flr
9afedfae25
fix(test): Remove frappe.local.request between requests
`frappe.local.request` was not cleared between tests, which would not be a problem if all tests did set it to another Request object. But, some tests directly fetch the response content using get_response_content without first setting the frappe.local.request object (using set_request).
2023-06-16 13:27:49 +02:00
Corentin Flr
bcdc483a13
fix(test): Fix test_never_render to get path as string, exclude PYC files from static downloads
This test code never actually tested the behaviour for two reasons:
- first, the page had an error which meant that a 500 Error page was returned (because `path` is not a string)
- second, every page contains the string "400" because it's contained in some of the icons.svg icons!

I also found a minor related bug in static_page.py, allowing people to download PYC files (pycache)
2023-06-15 18:36:30 +02:00
Ankush Menat
3d0888a5d5 refactor: set_value usage 2023-06-13 16:00:43 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
76e576c83e test: fix print view test from lang 2023-04-14 09:07:00 +05:30
gavin
cd524135c0
fix: TemplatePage.can_render (#20257)
Don't render python executable/loadable files from TemplatePage
renderer. This restricts access to reading/downloading possibly
private Python source code from Frappe applications
2023-03-06 12:40:15 +05:30
Faris Ansari
cfc2dd4437 test: patch get_hooks to bypass cache 2022-11-15 14:50:38 +05:30
Faris Ansari
e0a725025c test: for app_include_js and app_include_css 2022-11-11 20:47:18 +05:30
Faris Ansari
4f650854b8
fix(dx): resolve_class (#18417)
* fix(resolve_class): ignore False values

* fix: allow multiple arguments

* fix: remove unnecessary condition

* test: resolve_class
2022-10-15 17:40:22 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Ankush Menat
015937a03a test: fix anticipiated test failures 2022-08-04 14:50:24 +05:30
Suraj Shetty
3199be44cd test: Assert status_code according to the exception 2022-06-01 12:49:47 +05:30
Faris Ansari
eeab5edf5f test: test for metatag rendering 2022-05-11 13:29:03 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Ankush Menat
5c17f9ad79
Merge pull request #15661 from gavindsouza/thumbnail-for-images
fix: Thumbnail for external images (from URL)
2022-02-02 12:21:06 +05:30
Gavin D'souza
897b8a5b66 test: Add test for hosting binary file using StaticPage resolver 2022-01-19 19:30:08 +05:30
Gavin D'souza
227dc26707 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-17 14:04:13 +05:30
Gavin D'souza
3052808048 fix: Don't cast to str if None or Falsy
* refactor: use get_single_value instead of set_value(blah, None, blah1)
* User.reload in test_home_page to combat what happens locally
2022-01-10 15:05:57 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
Gavin D'souza
c1db7649eb test: Delete from Access Log before each website test
This should fix flaky test_printview_page which fails due to name
collision while creating access log documents
2021-10-27 14:37:19 +05:30
Gavin D'souza
f08faf151c test(website): Clear db.value_cache on tearDown 2021-10-22 18:18:14 +05:30
Gavin D'souza
a575cff8a7 fix: Retry flaky test_printview_page if errored 2021-10-19 12:35:55 +05:30
Faris Ansari
7a34c542c1 test: safe_render 2021-08-03 12:40:48 +05:30
Suraj Shetty
fccd19a44c test: Add test to validate minified js load 2021-07-03 14:13:16 +05:30
Suraj Shetty
4363e51c6d test: Fix improper tests for website rendering 2021-07-01 22:10:02 +05:30
Suraj Shetty
a93bb67030 test: Add test case to validate raw file load 2021-07-01 22:08:15 +05:30
Suraj Shetty
9ad276767f test: Reset no_cache flag 2021-06-24 13:30:11 +05:30
Suraj Shetty
62684a70c1 test: Clear website cache after changing look_for_sidebar flag 2021-06-24 12:05:24 +05:30
Suraj Shetty
090c604b0a test: Add test cases to validate caching 2021-06-24 12:01:04 +05:30
Suraj Shetty
e83e80c6af test: Move tests to correct test file 2021-06-24 10:23:07 +05:30
Suraj Shetty
6f3e6fee82 test: Add test to check ability to use get_context without context object 2021-06-24 10:22:27 +05:30
Suraj Shetty
1ef83ea15f test: Add printview page test 2021-06-04 11:50:03 +05:30
Suraj Shetty
2d8c6c1710 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-06-03 11:43:28 +05:30
Suraj Shetty
2544964501 test: Add test case to validate custom page renderer 2021-06-03 10:41:22 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Suraj Shetty
78206bea8f test: Clear hook cache after updating hook 2021-05-25 16:39:48 +05:30