Merge branch 'develop' into 32489-role-perm-based-masking
This commit is contained in:
commit
1d96a933cb
257 changed files with 1123 additions and 2185 deletions
1
.github/workflows/_base-server-tests.yml
vendored
1
.github/workflows/_base-server-tests.yml
vendored
|
|
@ -55,7 +55,6 @@ jobs:
|
|||
timeout-minutes: 30
|
||||
env:
|
||||
NODE_ENV: "production"
|
||||
PYTHONOPTIMIZE: 2
|
||||
# noisy 3rd party library warnings
|
||||
PYTHONWARNINGS: "module,ignore:::babel.messages.extract"
|
||||
DB_ROOT_PASSWORD: db_root
|
||||
|
|
|
|||
6
.github/workflows/_base-ui-tests.yml
vendored
6
.github/workflows/_base-ui-tests.yml
vendored
|
|
@ -44,7 +44,6 @@ jobs:
|
|||
timeout-minutes: 30
|
||||
env:
|
||||
NODE_ENV: "production"
|
||||
PYTHONOPTIMIZE: 2
|
||||
# noisy 3rd party library warnings
|
||||
PYTHONWARNINGS: "ignore"
|
||||
DB_ROOT_PASSWORD: db_root
|
||||
|
|
@ -99,6 +98,10 @@ jobs:
|
|||
bench --site test_site execute frappe.utils.install.complete_setup_wizard
|
||||
bench --site test_site execute frappe.tests.ui_test_helpers.create_test_user
|
||||
|
||||
- uses: browser-actions/setup-chrome@latest
|
||||
- run: |
|
||||
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
source ${GITHUB_WORKSPACE}/env/bin/activate
|
||||
|
|
@ -107,6 +110,7 @@ jobs:
|
|||
--with-coverage \
|
||||
--headless \
|
||||
--parallel \
|
||||
--browser ${{ env.BROWSER_PATH }} \
|
||||
--ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
|
||||
env:
|
||||
CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb
|
||||
|
|
|
|||
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
|
|
@ -95,7 +95,7 @@ jobs:
|
|||
run: |
|
||||
pip install pip-audit
|
||||
cd ${GITHUB_WORKSPACE}
|
||||
pip-audit --desc on .
|
||||
pip-audit --desc on --ignore-vuln PYSEC-2023-312 .
|
||||
|
||||
precommit:
|
||||
name: 'Pre-Commit'
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</div>
|
||||
|
||||
<div align="center">
|
||||
<a target="_blank" href="#LICENSE" title="License: MIT"><img src="https://img.shields.io/badge/License-MIT-success.svg"></a>
|
||||
<a target="_blank" href="LICENSE" title="License: MIT"><img src="https://img.shields.io/badge/License-MIT-success.svg"></a>
|
||||
<a href="https://codecov.io/gh/frappe/frappe"><img src="https://codecov.io/gh/frappe/frappe/branch/develop/graph/badge.svg?token=XoTa679hIj"/></a>
|
||||
</div>
|
||||
<div align="center">
|
||||
|
|
|
|||
|
|
@ -516,6 +516,7 @@ def sendmail(
|
|||
with_container=False,
|
||||
email_read_tracker_url=None,
|
||||
x_priority: Literal[1, 3, 5] = 3,
|
||||
email_headers=None,
|
||||
) -> Optional["EmailQueue"]:
|
||||
"""Send email using user's default **Email Account** or global default **Email Account**.
|
||||
|
||||
|
|
@ -544,6 +545,7 @@ def sendmail(
|
|||
:param header: Append header in email
|
||||
:param with_container: Wraps email inside a styled container
|
||||
:param x_priority: 1 = HIGHEST, 3 = NORMAL, 5 = LOWEST
|
||||
:param email_headers: Additional headers to be added in the email, e.g. {"X-Custom-Header": "value"} or {"Custom-Header": "value"}. Automatically prepends "X-" to the header name if not present.
|
||||
"""
|
||||
|
||||
if recipients is None:
|
||||
|
|
@ -600,6 +602,7 @@ def sendmail(
|
|||
with_container=with_container,
|
||||
email_read_tracker_url=email_read_tracker_url,
|
||||
x_priority=x_priority,
|
||||
email_headers=email_headers,
|
||||
)
|
||||
|
||||
# build email queue and send the email if send_now is True.
|
||||
|
|
@ -977,6 +980,8 @@ def get_document_cache_key(doctype: str, name: str):
|
|||
|
||||
|
||||
def clear_document_cache(doctype: str, name: str | None = None) -> None:
|
||||
frappe.db.value_cache.pop(doctype, None)
|
||||
|
||||
def clear_in_redis():
|
||||
if name is not None:
|
||||
cache.delete_value(get_document_cache_key(doctype, name))
|
||||
|
|
@ -1015,6 +1020,15 @@ def get_cached_value(
|
|||
return values
|
||||
|
||||
|
||||
def get_single_value(setting: str, fieldname: str, /, *, as_dict: bool = False):
|
||||
"""Return the cached value associated with the given fieldname from single DocType.
|
||||
|
||||
Usage:
|
||||
telemetry_enabled = frappe.get_single_value("System Settings", "telemetry_enabled")
|
||||
"""
|
||||
return get_cached_value(setting, setting, fieldname=fieldname, as_dict=as_dict)
|
||||
|
||||
|
||||
def get_last_doc(
|
||||
doctype,
|
||||
filters: FilterSignature | None = None,
|
||||
|
|
|
|||
|
|
@ -93,9 +93,7 @@ def freeze_gc():
|
|||
|
||||
|
||||
def optimize_for_gil_contention():
|
||||
from frappe.utils import sbool
|
||||
|
||||
if not bool(sbool(os.environ.get("FRAPPE_PERF_PIN_WORKERS", True))):
|
||||
if not os.environ.get("FRAPPE_PERF_PIN_WORKERS"):
|
||||
return
|
||||
|
||||
if "gunicorn" not in str(sys.argv[0]):
|
||||
|
|
|
|||
|
|
@ -41,6 +41,17 @@ def handle(request: Request):
|
|||
`DELETE` will delete
|
||||
"""
|
||||
|
||||
if frappe.get_system_settings("log_api_requests"):
|
||||
doc = frappe.get_doc(
|
||||
{
|
||||
"doctype": "API Request Log",
|
||||
"path": request.path,
|
||||
"user": frappe.session.user,
|
||||
"method": request.method,
|
||||
}
|
||||
)
|
||||
doc.deferred_insert()
|
||||
|
||||
try:
|
||||
endpoint, arguments = API_URL_MAP.bind_to_environ(request.environ).match()
|
||||
except NotFound: # Wrap 404 - backward compatiblity
|
||||
|
|
|
|||
|
|
@ -2,21 +2,12 @@
|
|||
# License: MIT. See LICENSE
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.utils import make_test_records
|
||||
|
||||
TEST_DOCTYPE = "Assignment Test"
|
||||
|
||||
|
||||
class UnitTestAssignmentRule(UnitTestCase):
|
||||
"""
|
||||
Unit tests for AssignmentRule.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestAutoAssign(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from frappe.automation.doctype.auto_repeat.auto_repeat import (
|
|||
week_map,
|
||||
)
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import add_days, add_months, getdate, today
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -32,15 +32,6 @@ def add_custom_fields() -> "CustomField":
|
|||
)
|
||||
|
||||
|
||||
class UnitTestAutoRepeat(UnitTestCase):
|
||||
"""
|
||||
Unit tests for AutoRepeat.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestAutoRepeat(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2019, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestMilestone(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Milestone.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestMilestone(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
import frappe.cache_manager
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestMilestoneTracker(UnitTestCase):
|
||||
"""
|
||||
Unit tests for MilestoneTracker.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestMilestoneTracker(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -4,19 +4,10 @@
|
|||
import frappe
|
||||
from frappe.automation.doctype.reminder.reminder import create_new_reminder, send_reminders
|
||||
from frappe.desk.doctype.notification_log.notification_log import get_notification_logs
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import add_to_date, now_datetime
|
||||
|
||||
|
||||
class UnitTestReminder(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Reminder.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestReminder(IntegrationTestCase):
|
||||
def test_reminder(self):
|
||||
description = "TEST_REMINDER"
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ def get_bootinfo():
|
|||
|
||||
|
||||
def remove_apps_with_incomplete_dependencies(bootinfo):
|
||||
remove_apps = []
|
||||
remove_apps = set()
|
||||
|
||||
for app in bootinfo.setup_wizard_not_required_apps:
|
||||
if app in bootinfo.setup_wizard_completed_apps:
|
||||
|
|
@ -142,7 +142,7 @@ def remove_apps_with_incomplete_dependencies(bootinfo):
|
|||
continue
|
||||
|
||||
if required_app not in bootinfo.setup_wizard_completed_apps:
|
||||
remove_apps.append(app)
|
||||
remove_apps.add(app)
|
||||
|
||||
for app in remove_apps:
|
||||
bootinfo.setup_wizard_not_required_apps.remove(app)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import click
|
||||
|
|
@ -32,8 +33,30 @@ def main(
|
|||
debug: bool = False,
|
||||
debug_exceptions: tuple[Exception] | None = None,
|
||||
selected_categories: list[str] | None = None,
|
||||
lightmode: bool = False,
|
||||
) -> None:
|
||||
"""Main function to run tests"""
|
||||
if lightmode:
|
||||
from frappe.testing.config import TestParameters
|
||||
|
||||
test_params = TestParameters(
|
||||
site=site,
|
||||
app=app,
|
||||
module=module,
|
||||
doctype=doctype,
|
||||
module_def=module_def,
|
||||
verbose=verbose,
|
||||
tests=tests,
|
||||
force=force,
|
||||
profile=profile,
|
||||
junit_xml_output=junit_xml_output,
|
||||
doctype_list_path=doctype_list_path,
|
||||
failfast=failfast,
|
||||
case=case,
|
||||
)
|
||||
run_tests_in_light_mode(test_params)
|
||||
return
|
||||
|
||||
import logging
|
||||
|
||||
from frappe.testing import (
|
||||
|
|
@ -157,6 +180,28 @@ def main(
|
|||
testing_module_logger.debug(f"Total test run time: {end_time - start_time:.3f} seconds")
|
||||
|
||||
|
||||
def run_tests_in_light_mode(test_params):
|
||||
from frappe.testing.loader import FrappeTestLoader
|
||||
from frappe.testing.result import FrappeTestResult
|
||||
|
||||
# init environment
|
||||
frappe.init(test_params.site)
|
||||
if not frappe.db:
|
||||
frappe.connect()
|
||||
|
||||
# disable scheduler
|
||||
global scheduler_disabled_by_user
|
||||
scheduler_disabled_by_user = frappe.utils.scheduler.is_scheduler_disabled(verbose=False)
|
||||
if not scheduler_disabled_by_user:
|
||||
frappe.utils.scheduler.disable_scheduler()
|
||||
frappe.clear_cache()
|
||||
|
||||
suite = FrappeTestLoader().discover_tests(test_params)
|
||||
result = unittest.TextTestRunner(failfast=test_params.failfast, resultclass=FrappeTestResult).run(suite)
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _setup_xml_output(junit_xml_output):
|
||||
"""Setup XML output for test results if specified"""
|
||||
global unittest_runner
|
||||
|
|
@ -246,6 +291,7 @@ def _get_doctypes_for_module_def(app, module_def):
|
|||
default="all",
|
||||
help="Select test category to run",
|
||||
)
|
||||
@click.option("--lightmode", is_flag=True, default=False)
|
||||
@pass_context
|
||||
def run_tests(
|
||||
context: CliCtxObj,
|
||||
|
|
@ -263,6 +309,7 @@ def run_tests(
|
|||
failfast=False,
|
||||
case=None,
|
||||
test_category="all",
|
||||
lightmode=False,
|
||||
debug=False,
|
||||
):
|
||||
"""Run python unit-tests"""
|
||||
|
|
@ -307,6 +354,7 @@ def run_tests(
|
|||
skip_before_tests=skip_before_tests,
|
||||
debug=debug,
|
||||
selected_categories=[] if test_category == "all" else test_category,
|
||||
lightmode=lightmode,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ def destroy_all_sessions(context: CliCtxObj, reason=None):
|
|||
@click.option("--format", "-f", type=click.Choice(["text", "json"]), default="text")
|
||||
@pass_context
|
||||
def show_config(context: CliCtxObj, format):
|
||||
"Print configuration file to STDOUT in speified format"
|
||||
"Print configuration file to STDOUT in specified format"
|
||||
|
||||
if not context.sites:
|
||||
raise SiteNotSpecifiedError
|
||||
|
|
|
|||
|
|
@ -4,16 +4,7 @@ from functools import partial
|
|||
|
||||
import frappe
|
||||
from frappe.contacts.doctype.address.address import address_query, get_address_display
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestAddress(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Address.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestAddress(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,19 +2,10 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.contacts.doctype.address_template.address_template import get_default_address_template
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils.jinja import validate_template
|
||||
|
||||
|
||||
class UnitTestAddressTemplate(UnitTestCase):
|
||||
"""
|
||||
Unit tests for AddressTemplate.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestAddressTemplate(IntegrationTestCase):
|
||||
def setUp(self) -> None:
|
||||
frappe.db.delete("Address Template", {"country": "India"})
|
||||
|
|
|
|||
|
|
@ -3,20 +3,11 @@
|
|||
import frappe
|
||||
from frappe.contacts.doctype.contact.contact import get_full_name
|
||||
from frappe.email import get_contact_list
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = ["Contact", "Salutation"]
|
||||
|
||||
|
||||
class UnitTestContact(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Contact.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestContact(IntegrationTestCase):
|
||||
def test_check_default_email(self):
|
||||
emails = [
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestGender(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Gender.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestGender(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestSalutation(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Salutation.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestSalutation(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -14,19 +14,10 @@ from frappe.core.doctype.data_import.data_import import export_csv
|
|||
from frappe.core.doctype.user.user import generate_keys
|
||||
|
||||
# imports - standard imports
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import cstr, get_site_url
|
||||
|
||||
|
||||
class UnitTestAccessLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for AccessLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestAccessLog(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
# generate keys for current user to send requests for the following tests
|
||||
|
|
|
|||
|
|
@ -4,16 +4,7 @@ import time
|
|||
|
||||
import frappe
|
||||
from frappe.auth import CookieManager, LoginManager
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestActivityLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ActivityLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestActivityLog(IntegrationTestCase):
|
||||
|
|
|
|||
0
frappe/core/doctype/api_request_log/__init__.py
Normal file
0
frappe/core/doctype/api_request_log/__init__.py
Normal file
8
frappe/core/doctype/api_request_log/api_request_log.js
Normal file
8
frappe/core/doctype/api_request_log/api_request_log.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2025, Frappe Technologies and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("API Request Log", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
62
frappe/core/doctype/api_request_log/api_request_log.json
Normal file
62
frappe/core/doctype/api_request_log/api_request_log.json
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-05-21 16:51:56.070193",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"path",
|
||||
"method",
|
||||
"user"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "path",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Path"
|
||||
},
|
||||
{
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "User",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"fieldname": "method",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Method"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-05-21 17:09:55.054044",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "API Request Log",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
28
frappe/core/doctype/api_request_log/api_request_log.py
Normal file
28
frappe/core/doctype/api_request_log/api_request_log.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright (c) 2025, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class APIRequestLog(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
method: DF.Data | None
|
||||
path: DF.Data | None
|
||||
user: DF.Link | None
|
||||
# end: auto-generated types
|
||||
|
||||
@staticmethod
|
||||
def clear_old_logs(days: int = 90):
|
||||
from frappe.query_builder import Interval
|
||||
from frappe.query_builder.functions import Now
|
||||
|
||||
table = frappe.qb.DocType("API Request Log")
|
||||
frappe.db.delete(table, filters=(table.creation < (Now() - Interval(days=days))))
|
||||
20
frappe/core/doctype/api_request_log/test_api_request_log.py
Normal file
20
frappe/core/doctype/api_request_log/test_api_request_log.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2025, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class IntegrationTestAPIRequestLog(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for APIRequestLog.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
|
@ -2,19 +2,10 @@
|
|||
# See license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import today
|
||||
|
||||
|
||||
class UnitTestAuditTrail(UnitTestCase):
|
||||
"""
|
||||
Unit tests for AuditTrail.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestAuditTrail(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
self.child_doctype = create_custom_child_doctype()
|
||||
|
|
|
|||
|
|
@ -4,20 +4,11 @@ import json
|
|||
|
||||
import frappe
|
||||
from frappe.templates.includes.comments.comments import add_comment
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.test_model_utils import set_user
|
||||
from frappe.website.doctype.blog_post.test_blog_post import make_test_blog
|
||||
|
||||
|
||||
class UnitTestComment(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Comment.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestComment(IntegrationTestCase):
|
||||
def test_comment_creation(self):
|
||||
test_doc = frappe.get_doc(doctype="ToDo", description="test")
|
||||
|
|
|
|||
|
|
@ -490,8 +490,8 @@ def get_permission_query_conditions_for_communication(user):
|
|||
return """`tabCommunication`.communication_medium!='Email'"""
|
||||
|
||||
email_accounts = ['"{}"'.format(account.get("email_account")) for account in accounts]
|
||||
return """`tabCommunication`.email_account in ({email_accounts})""".format(
|
||||
email_accounts=",".join(email_accounts)
|
||||
return """`tabCommunication`.email_account in ({email_accounts}) or `tabCommunication`.recipients LIKE '%{user}%' or `tabCommunication`.sender LIKE '%{user}%' or `tabCommunication`.cc LIKE '%{user}%' or `tabCommunication`.bcc LIKE '%{user}%'""".format(
|
||||
email_accounts=",".join(email_accounts), user=user
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,22 +6,13 @@ import frappe
|
|||
from frappe.core.doctype.communication.communication import Communication, get_emails, parse_email
|
||||
from frappe.core.doctype.communication.email import add_attachments, make
|
||||
from frappe.email.doctype.email_queue.email_queue import EmailQueue
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.contacts.doctype.contact.contact import Contact
|
||||
from frappe.email.doctype.email_account.email_account import EmailAccount
|
||||
|
||||
|
||||
class UnitTestCommunication(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Communication.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestCommunication(IntegrationTestCase):
|
||||
def test_email(self):
|
||||
valid_email_list = [
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestCustomDocperm(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CustomDocperm.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestCustomDocPerm(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestCustomRole(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CustomRole.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestCustomRole(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.core.doctype.data_export.exporter import DataExporter
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDataExport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DataExport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDataExporter(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDataImport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DataImport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDataImport(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -3,20 +3,11 @@
|
|||
import frappe
|
||||
from frappe.core.doctype.data_import.exporter import Exporter
|
||||
from frappe.core.doctype.data_import.test_importer import create_doctype_if_not_exists
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
doctype_name = "DocType for Export"
|
||||
|
||||
|
||||
class UnitTestDataImport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DataImport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestExporter(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
create_doctype_if_not_exists(doctype_name)
|
||||
|
|
|
|||
|
|
@ -2,22 +2,13 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.core.doctype.data_import.importer import Importer
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.test_query_builder import db_type_is, run_only_if
|
||||
from frappe.utils import format_duration, getdate
|
||||
|
||||
doctype_name = "DocType for Import"
|
||||
|
||||
|
||||
class UnitTestDataImport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DataImport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestImporter(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDataImportLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DataImportLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDataImportLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDeletedDocument(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DeletedDocument.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDeletedDocument(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -4,20 +4,11 @@
|
|||
import frappe
|
||||
import frappe.share
|
||||
from frappe.automation.doctype.auto_repeat.test_auto_repeat import create_submittable_doctype
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = ["User"]
|
||||
|
||||
|
||||
class UnitTestDocshare(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Docshare.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestDocShare(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
self.user = "test@example.com"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
|
|
@ -12,14 +12,6 @@ EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
|||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTest{classname}(UnitTestCase):
|
||||
"""
|
||||
Unit tests for {classname}.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTest{classname}(IntegrationTestCase):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -25,19 +25,10 @@ from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
|||
from frappe.desk.form.load import getdoc
|
||||
from frappe.model.delete_doc import delete_controllers
|
||||
from frappe.model.sync import remove_orphan_doctypes
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import get_table_name
|
||||
|
||||
|
||||
class UnitTestDoctype(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Doctype.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestDocType(IntegrationTestCase):
|
||||
def tearDown(self):
|
||||
frappe.db.rollback()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDocumentNamingRule(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DocumentNamingRule.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDocumentNamingRule(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDocumentNamingRuleCondition(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DocumentNamingRuleCondition.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDocumentNamingRuleCondition(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -7,19 +7,10 @@ from frappe.core.doctype.document_naming_settings.document_naming_settings impor
|
|||
DocumentNamingSettings,
|
||||
)
|
||||
from frappe.model.naming import NamingSeries, get_default_naming_series
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import cint
|
||||
|
||||
|
||||
class UnitTestDocumentNamingSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DocumentNamingSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestNamingSeries(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDocumentShareKey(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DocumentShareKey.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDocumentShareKey(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDomain(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Domain.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDomain(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -5,19 +5,10 @@ from unittest.mock import patch
|
|||
from ldap3.core.exceptions import LDAPException, LDAPInappropriateAuthenticationResult
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils.error import _is_ldap_exception, guess_exception_source
|
||||
|
||||
|
||||
class UnitTestErrorLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ErrorLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestErrorLog(IntegrationTestCase):
|
||||
def test_error_log(self):
|
||||
"""let's do an error log on error log?"""
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from frappe.core.doctype.file.exceptions import FileTypeNotAllowed
|
|||
from frappe.core.doctype.file.utils import get_corrupted_image_msg, get_extension
|
||||
from frappe.desk.form.utils import add_comment
|
||||
from frappe.exceptions import ValidationError
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import get_files_path, set_request
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -61,15 +61,6 @@ def make_test_image_file(private=False):
|
|||
_test_file.delete()
|
||||
|
||||
|
||||
class UnitTestFile(UnitTestCase):
|
||||
"""
|
||||
Unit tests for File.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestSimpleFile(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
self.attached_to_doctype, self.attached_to_docname = make_test_doc()
|
||||
|
|
|
|||
|
|
@ -6,16 +6,7 @@ from frappe.core.doctype.installed_applications.installed_applications import (
|
|||
InvalidAppOrder,
|
||||
update_installed_apps_order,
|
||||
)
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestInstalledApplications(UnitTestCase):
|
||||
"""
|
||||
Unit tests for InstalledApplications.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestInstalledApplications(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestLanguage(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Language.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestLanguage(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestLogSettingUser(UnitTestCase):
|
||||
"""
|
||||
Unit tests for LogSettingUser.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestLogSettingUser(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ LOG_DOCTYPES = [
|
|||
"Email Queue Recipient",
|
||||
"Error Log",
|
||||
"OAuth Bearer Token",
|
||||
"API Request Log",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,19 +5,10 @@ from datetime import datetime
|
|||
|
||||
import frappe
|
||||
from frappe.core.doctype.log_settings.log_settings import _supports_log_clearing, run_log_clean_up
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import add_to_date, now_datetime
|
||||
|
||||
|
||||
class UnitTestLogSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for LogSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestLogSettings(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestModuleDef(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ModuleDef.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestModuleDef(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestModuleProfile(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ModuleProfile.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestModuleProfile(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestNavbarItem(UnitTestCase):
|
||||
"""
|
||||
Unit tests for NavbarItem.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestNavbarItem(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestNavbarSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for NavbarSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestNavbarSettings(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -5,16 +5,7 @@ import json
|
|||
import os
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPackage(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Package.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPackage(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPackageImport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PackageImport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPackageImport(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPackageRelease(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PackageRelease.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPackageRelease(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -5,16 +5,7 @@ import unittest
|
|||
from unittest.mock import patch
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPage(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Page.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPage(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPatchLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PatchLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPatchLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPermissionInspector(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PermissionInspector.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPermissionInspector(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPermissionLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PermissionLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPermissionLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -7,19 +7,10 @@ from contextlib import contextmanager
|
|||
import frappe
|
||||
from frappe.desk.query_report import generate_report_result, get_report_doc
|
||||
from frappe.query_builder.utils import db_type_is
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase, timeout
|
||||
from frappe.tests import IntegrationTestCase, timeout
|
||||
from frappe.tests.test_query_builder import run_only_if
|
||||
|
||||
|
||||
class UnitTestPreparedReport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PreparedReport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestPreparedReport(IntegrationTestCase):
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
|
|
|||
|
|
@ -8,20 +8,11 @@ import frappe.recorder
|
|||
from frappe.core.doctype.recorder.recorder import _optimize_query, serialize_request
|
||||
from frappe.query_builder.utils import db_type_is
|
||||
from frappe.recorder import get as get_recorder_data
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.test_query_builder import run_only_if
|
||||
from frappe.utils import set_request
|
||||
|
||||
|
||||
class UnitTestRecorder(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Recorder.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestRecorder(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
self.start_recoder()
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestRecorderQuery(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RecorderQuery.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestRecorderQuery(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -11,20 +11,11 @@ from frappe.custom.doctype.customize_form.customize_form import reset_customizat
|
|||
from frappe.desk.query_report import add_total_row, run, save_report
|
||||
from frappe.desk.reportview import delete_report
|
||||
from frappe.desk.reportview import save_report as _save_report
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = ["User"]
|
||||
|
||||
|
||||
class UnitTestReport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Report.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestReport(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
|
|
|
|||
|
|
@ -3,16 +3,7 @@
|
|||
|
||||
import frappe
|
||||
from frappe.core.doctype.role.role import get_info_based_on_role
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestRole(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Role.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestUser(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestRolePermissionForPageAndReport(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RolePermissionForPageAndReport.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestRolePermissionforPageandReport(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,20 +1,11 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = ["Role"]
|
||||
|
||||
|
||||
class UnitTestRoleProfile(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RoleProfile.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestRoleProfile(IntegrationTestCase):
|
||||
def test_make_new_role_profiles(self):
|
||||
frappe.delete_doc_if_exists("Role Profile", "Test 1", force=1)
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestRoleReplication(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RoleReplication.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestRoleReplication(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from rq.job import Job
|
|||
import frappe
|
||||
from frappe.core.doctype.rq_job.rq_job import RQJob, remove_failed_jobs, stop_job
|
||||
from frappe.installer import update_site_config
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase, timeout
|
||||
from frappe.tests import IntegrationTestCase, timeout
|
||||
from frappe.utils import cstr, execute_in_shell
|
||||
from frappe.utils.background_jobs import get_job_status, is_job_enqueued
|
||||
|
||||
|
|
@ -23,15 +23,6 @@ def wait_for_completion(job: Job):
|
|||
time.sleep(0.2)
|
||||
|
||||
|
||||
class UnitTestRqJob(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RqJob.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestRQJob(IntegrationTestCase):
|
||||
BG_JOB = "frappe.core.doctype.rq_job.test_rq_job.test_func"
|
||||
|
||||
|
|
@ -175,7 +166,7 @@ class TestRQJob(IntegrationTestCase):
|
|||
# If this starts failing analyze memory usage using memray or some equivalent tool to find
|
||||
# offending imports/function calls.
|
||||
# Refer this PR: https://github.com/frappe/frappe/pull/21467
|
||||
LAST_MEASURED_USAGE = 42
|
||||
LAST_MEASURED_USAGE = 46
|
||||
if frappe.conf.use_mysqlclient:
|
||||
# TEMP: Add extra allowance for running two connectors, this should be rolled back before v16
|
||||
LAST_MEASURED_USAGE += 2
|
||||
|
|
|
|||
|
|
@ -3,16 +3,7 @@
|
|||
|
||||
import frappe
|
||||
from frappe.core.doctype.rq_worker.rq_worker import RQWorker
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestRqWorker(UnitTestCase):
|
||||
"""
|
||||
Unit tests for RqWorker.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestRQWorker(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2019, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestScheduledJobLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ScheduledJobLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestScheduledJobLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -4,20 +4,11 @@ from datetime import timedelta
|
|||
|
||||
import frappe
|
||||
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import get_datetime
|
||||
from frappe.utils.data import add_to_date, now_datetime
|
||||
|
||||
|
||||
class UnitTestScheduledJobType(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ScheduledJobType.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestScheduledJobType(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
frappe.db.rollback()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
|
|
@ -11,15 +11,6 @@ EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
|||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestSchedulerEvent(UnitTestCase):
|
||||
"""
|
||||
Unit tests for SchedulerEvent.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestSchedulerEvent(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for SchedulerEvent.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import frappe
|
|||
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import ScheduledJobType, sync_jobs
|
||||
from frappe.core.doctype.server_script.server_script import ServerScript
|
||||
from frappe.frappeclient import FrappeClient, FrappeException
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.utils import get_site_url
|
||||
|
||||
scripts = [
|
||||
|
|
@ -108,15 +108,6 @@ doc.save()
|
|||
]
|
||||
|
||||
|
||||
class UnitTestServerScript(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ServerScript.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestServerScript(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -5,16 +5,7 @@ from frappe.core.doctype.session_default_settings.session_default_settings impor
|
|||
clear_session_defaults,
|
||||
set_session_default_values,
|
||||
)
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestSessionDefaultSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for SessionDefaultSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestSessionDefaultSettings(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestSmsSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for SmsSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestSMSSettings(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -5,22 +5,13 @@ import time
|
|||
import typing
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase, timeout
|
||||
from frappe.tests import IntegrationTestCase, timeout
|
||||
from frappe.utils.background_jobs import get_queue
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from rq.job import Job
|
||||
|
||||
|
||||
class UnitTestSubmissionQueue(UnitTestCase):
|
||||
"""
|
||||
Unit tests for SubmissionQueue.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestSubmissionQueue(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
|
|
@ -105,7 +105,9 @@
|
|||
"allow_error_traceback",
|
||||
"enable_telemetry",
|
||||
"search_section",
|
||||
"link_field_results_limit"
|
||||
"link_field_results_limit",
|
||||
"api_logging_section",
|
||||
"log_api_requests"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
|
|
@ -714,6 +716,17 @@
|
|||
"fieldname": "enable_data_masking",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Data Masking"
|
||||
},
|
||||
{
|
||||
"fieldname": "api_logging_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "API Logging"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "log_api_requests",
|
||||
"fieldtype": "Check",
|
||||
"label": "Log API Requests"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cog",
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class SystemSettings(Document):
|
|||
language: DF.Link
|
||||
lifespan_qrcode_image: DF.Int
|
||||
link_field_results_limit: DF.Int
|
||||
log_api_requests: DF.Check
|
||||
login_with_email_link: DF.Check
|
||||
login_with_email_link_expiry: DF.Int
|
||||
logout_on_password_reset: DF.Check
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestSystemSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for SystemSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestSystemSettings(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -3,16 +3,7 @@
|
|||
import hashlib
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestTransactionLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for TransactionLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestTransactionLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestTranslation(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Translation.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestTranslation(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from frappe.core.doctype.user.user import (
|
|||
from frappe.desk.notifications import extract_mentions
|
||||
from frappe.frappeclient import FrappeClient
|
||||
from frappe.model.delete_doc import delete_doc
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.classes.context_managers import change_settings
|
||||
from frappe.tests.test_api import FrappeAPITestCase
|
||||
from frappe.utils import get_url
|
||||
|
|
@ -30,15 +30,6 @@ from frappe.utils import get_url
|
|||
user_module = frappe.core.doctype.user.user
|
||||
|
||||
|
||||
class UnitTestUser(UnitTestCase):
|
||||
"""
|
||||
Unit tests for User.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestUser(IntegrationTestCase):
|
||||
def tearDown(self):
|
||||
# disable password strength test
|
||||
|
|
|
|||
|
|
@ -638,6 +638,7 @@ class User(Document):
|
|||
def add_roles(self, *roles):
|
||||
"""Add roles to user and save"""
|
||||
self.append_roles(*roles)
|
||||
# test_user_permission.create_user depends on this
|
||||
self.save()
|
||||
|
||||
def remove_roles(self, *roles):
|
||||
|
|
@ -1048,7 +1049,7 @@ def sign_up(email: str, full_name: str, redirect_to: str) -> tuple[int, str]:
|
|||
user.insert()
|
||||
|
||||
# set default signup role as per Portal Settings
|
||||
default_role = frappe.db.get_single_value("Portal Settings", "default_role")
|
||||
default_role = frappe.get_single_value("Portal Settings", "default_role")
|
||||
if default_role:
|
||||
user.add_roles(default_role)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2021, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestUserGroup(UnitTestCase):
|
||||
"""
|
||||
Unit tests for UserGroup.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestUserGroup(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2021, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestUserGroupMember(UnitTestCase):
|
||||
"""
|
||||
Unit tests for UserGroupMember.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestUserGroupMember(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -7,19 +7,10 @@ from frappe.core.doctype.user_permission.user_permission import (
|
|||
remove_applicable,
|
||||
)
|
||||
from frappe.permissions import add_permission, has_user_permission
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.website.doctype.blog_post.test_blog_post import make_test_blog
|
||||
|
||||
|
||||
class UnitTestUserPermission(UnitTestCase):
|
||||
"""
|
||||
Unit tests for UserPermission.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestUserPermission(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
test_users = (
|
||||
|
|
@ -306,6 +297,7 @@ def create_user(email, *roles):
|
|||
if not roles:
|
||||
roles = ("System Manager",)
|
||||
|
||||
# this triggers doc.save, so explicit save is not needed
|
||||
user.add_roles(*roles)
|
||||
return user
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.installer import update_site_config
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestUserType(UnitTestCase):
|
||||
"""
|
||||
Unit tests for UserType.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestUserType(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -4,19 +4,10 @@ import copy
|
|||
|
||||
import frappe
|
||||
from frappe.core.doctype.version.version import get_diff
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.utils import make_test_objects
|
||||
|
||||
|
||||
class UnitTestVersion(UnitTestCase):
|
||||
"""
|
||||
Unit tests for Version.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestVersion(IntegrationTestCase):
|
||||
def test_get_diff(self):
|
||||
frappe.set_user("Administrator")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2018, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestViewLog(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ViewLog.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestViewLog(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestClientScript(UnitTestCase):
|
||||
"""
|
||||
Unit tests for ClientScript.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestClientScript(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -7,16 +7,7 @@ from frappe.custom.doctype.custom_field.custom_field import (
|
|||
create_custom_fields,
|
||||
rename_fieldname,
|
||||
)
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestCustomField(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CustomField.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestCustomField(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -6,21 +6,12 @@ import json
|
|||
import frappe
|
||||
from frappe.core.doctype.doctype.doctype import InvalidFieldNameError
|
||||
from frappe.core.doctype.doctype.test_doctype import new_doctype
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
from frappe.tests import IntegrationTestCase
|
||||
from frappe.tests.utils import make_test_records_for_doctype
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = ["Custom Field", "Property Setter"]
|
||||
|
||||
|
||||
class UnitTestCustomizeForm(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CustomizeForm.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestCustomizeForm(IntegrationTestCase):
|
||||
def insert_custom_field(self):
|
||||
frappe.delete_doc_if_exists("Custom Field", "Event-custom_test_field")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
# Copyright (c) 2020, Frappe Technologies and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestDoctypeLayout(UnitTestCase):
|
||||
"""
|
||||
Unit tests for DoctypeLayout.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestDocTypeLayout(IntegrationTestCase):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
class UnitTestPropertySetter(UnitTestCase):
|
||||
"""
|
||||
Unit tests for PropertySetter.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
|
||||
class TestPropertySetter(IntegrationTestCase):
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue