Просмотр исходного кода

Merge pull request #17986 from frappe/version-14-hotfix

chore: weekly version 14 release
version-14
Ankush Menat 2 лет назад
committed by GitHub
Родитель
Сommit
5c26924ce6
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
100 измененных файлов: 357 добавлений и 294 удалений
  1. +1
    -6
      CODEOWNERS
  2. +26
    -1
      cypress/integration/sidebar.js
  3. +14
    -13
      cypress/integration/web_form.js
  4. +4
    -3
      frappe/automation/doctype/assignment_rule/test_assignment_rule.py
  5. +2
    -3
      frappe/automation/doctype/auto_repeat/test_auto_repeat.py
  6. +2
    -2
      frappe/automation/doctype/milestone/test_milestone.py
  7. +2
    -3
      frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py
  8. +56
    -0
      frappe/commands/site.py
  9. +2
    -3
      frappe/contacts/doctype/address/test_address.py
  10. +2
    -3
      frappe/contacts/doctype/address_template/test_address_template.py
  11. +2
    -3
      frappe/contacts/doctype/contact/test_contact.py
  12. +2
    -2
      frappe/contacts/doctype/gender/test_gender.py
  13. +2
    -2
      frappe/contacts/doctype/salutation/test_salutation.py
  14. +2
    -3
      frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py
  15. +4
    -4
      frappe/core/doctype/access_log/test_access_log.py
  16. +2
    -2
      frappe/core/doctype/activity_log/test_activity_log.py
  17. +2
    -2
      frappe/core/doctype/comment/test_comment.py
  18. +0
    -1
      frappe/core/doctype/communication/test_communication.py
  19. +2
    -2
      frappe/core/doctype/custom_docperm/test_custom_docperm.py
  20. +2
    -2
      frappe/core/doctype/custom_role/test_custom_role.py
  21. +2
    -3
      frappe/core/doctype/data_export/test_data_exporter.py
  22. +10
    -10
      frappe/core/doctype/data_import/importer.py
  23. +2
    -2
      frappe/core/doctype/data_import/test_data_import.py
  24. +2
    -3
      frappe/core/doctype/data_import/test_exporter.py
  25. +3
    -3
      frappe/core/doctype/data_import/test_importer.py
  26. +2
    -2
      frappe/core/doctype/data_import_log/test_data_import_log.py
  27. +2
    -2
      frappe/core/doctype/deleted_document/test_deleted_document.py
  28. +2
    -3
      frappe/core/doctype/docshare/test_docshare.py
  29. +8
    -1
      frappe/core/doctype/doctype/doctype.json
  30. +2
    -2
      frappe/core/doctype/doctype/test_doctype.py
  31. +2
    -3
      frappe/core/doctype/document_naming_rule/test_document_naming_rule.py
  32. +2
    -2
      frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py
  33. +2
    -2
      frappe/core/doctype/document_share_key/test_document_share_key.py
  34. +2
    -2
      frappe/core/doctype/domain/test_domain.py
  35. +2
    -3
      frappe/core/doctype/error_log/test_error_log.py
  36. +2
    -2
      frappe/core/doctype/error_snapshot/test_error_snapshot.py
  37. +2
    -2
      frappe/core/doctype/file/test_file.py
  38. +2
    -2
      frappe/core/doctype/installed_applications/test_installed_applications.py
  39. +2
    -2
      frappe/core/doctype/language/test_language.py
  40. +2
    -2
      frappe/core/doctype/log_setting_user/test_log_setting_user.py
  41. +2
    -2
      frappe/core/doctype/module_def/test_module_def.py
  42. +2
    -3
      frappe/core/doctype/module_profile/test_module_profile.py
  43. +2
    -2
      frappe/core/doctype/navbar_item/test_navbar_item.py
  44. +2
    -2
      frappe/core/doctype/navbar_settings/test_navbar_settings.py
  45. +2
    -2
      frappe/core/doctype/package/test_package.py
  46. +2
    -2
      frappe/core/doctype/package_import/test_package_import.py
  47. +2
    -2
      frappe/core/doctype/package_release/test_package_release.py
  48. +2
    -3
      frappe/core/doctype/page/test_page.py
  49. +2
    -2
      frappe/core/doctype/patch_log/test_patch_log.py
  50. +2
    -2
      frappe/core/doctype/prepared_report/test_prepared_report.py
  51. +2
    -2
      frappe/core/doctype/role/test_role.py
  52. +2
    -3
      frappe/core/doctype/role_profile/test_role_profile.py
  53. +2
    -2
      frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py
  54. +2
    -3
      frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py
  55. +3
    -4
      frappe/core/doctype/server_script/test_server_script.py
  56. +2
    -3
      frappe/core/doctype/session_default_settings/test_session_default_settings.py
  57. +2
    -2
      frappe/core/doctype/sms_settings/test_sms_settings.py
  58. +1
    -1
      frappe/core/doctype/system_settings/system_settings.js
  59. +2
    -2
      frappe/core/doctype/system_settings/test_system_settings.py
  60. +2
    -2
      frappe/core/doctype/transaction_log/test_transaction_log.py
  61. +15
    -10
      frappe/core/doctype/translation/test_translation.py
  62. +2
    -2
      frappe/core/doctype/user/test_user.py
  63. +2
    -2
      frappe/core/doctype/user_group/test_user_group.py
  64. +2
    -2
      frappe/core/doctype/user_group_member/test_user_group_member.py
  65. +2
    -3
      frappe/core/doctype/user_permission/test_user_permission.py
  66. +2
    -3
      frappe/core/doctype/user_type/test_user_type.py
  67. +2
    -2
      frappe/core/doctype/version/test_version.py
  68. +2
    -3
      frappe/core/doctype/view_log/test_view_log.py
  69. +2
    -2
      frappe/custom/doctype/client_script/test_client_script.py
  70. +2
    -3
      frappe/custom/doctype/custom_field/test_custom_field.py
  71. +23
    -4
      frappe/custom/doctype/customize_form/customize_form.json
  72. +1
    -0
      frappe/custom/doctype/customize_form/customize_form.py
  73. +2
    -2
      frappe/custom/doctype/customize_form/test_customize_form.py
  74. +2
    -2
      frappe/custom/doctype/doctype_layout/test_doctype_layout.py
  75. +2
    -2
      frappe/custom/doctype/property_setter/test_property_setter.py
  76. +1
    -2
      frappe/defaults.py
  77. +2
    -2
      frappe/desk/doctype/console_log/test_console_log.py
  78. +2
    -2
      frappe/desk/doctype/dashboard/test_dashboard.py
  79. +2
    -2
      frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py
  80. +2
    -2
      frappe/desk/doctype/event/test_event.py
  81. +2
    -2
      frappe/desk/doctype/form_tour/test_form_tour.py
  82. +2
    -2
      frappe/desk/doctype/kanban_board/test_kanban_board.py
  83. +2
    -2
      frappe/desk/doctype/list_view_settings/test_list_view_settings.py
  84. +2
    -2
      frappe/desk/doctype/module_onboarding/test_module_onboarding.py
  85. +2
    -3
      frappe/desk/doctype/note/test_note.py
  86. +2
    -3
      frappe/desk/doctype/notification_log/test_notification_log.py
  87. +2
    -2
      frappe/desk/doctype/notification_settings/test_notification_settings.py
  88. +2
    -2
      frappe/desk/doctype/number_card/test_number_card.py
  89. +2
    -2
      frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py
  90. +2
    -2
      frappe/desk/doctype/onboarding_step/test_onboarding_step.py
  91. +2
    -3
      frappe/desk/doctype/system_console/test_system_console.py
  92. +2
    -3
      frappe/desk/doctype/tag/test_tag.py
  93. +2
    -2
      frappe/desk/doctype/tag_link/test_tag_link.py
  94. +2
    -3
      frappe/desk/doctype/todo/test_todo.py
  95. +2
    -3
      frappe/desk/doctype/workspace/test_workspace.py
  96. +4
    -3
      frappe/desk/form/test_form.py
  97. +2
    -2
      frappe/email/doctype/auto_email_report/test_auto_email_report.py
  98. +2
    -2
      frappe/email/doctype/document_follow/test_document_follow.py
  99. +17
    -36
      frappe/email/doctype/email_account/email_account.js
  100. +4
    -4
      frappe/email/doctype/email_account/email_account.json

+ 1
- 6
CODEOWNERS Просмотреть файл

@@ -6,13 +6,8 @@
* @frappe/frappe-review-team
templates/ @surajshetty3416
www/ @surajshetty3416
patches/ @surajshetty3416 @gavindsouza
patches/ @surajshetty3416
event_streaming/ @ruchamahabal
data_import* @netchampfaris
core/ @surajshetty3416
database @gavindsouza
model @gavindsouza
pyproject.toml @gavindsouza
query_builder/ @gavindsouza
commands/ @gavindsouza
workspace @shariquerik

+ 26
- 1
cypress/integration/sidebar.js Просмотреть файл

@@ -1,11 +1,36 @@
const verify_attachment_visibility = (document, is_private) => {
cy.visit(`/app/${document}`);

const assertion = is_private ? "be.checked" : "not.be.checked";
cy.findByRole("button", { name: "Attach File" }).click();

cy.get_open_dialog().find(".file-upload-area").attachFile("sample_image.jpg", {
subjectType: "drag-n-drop",
});

cy.get_open_dialog().findByRole("checkbox", { name: "Private" }).should(assertion);
};

context("Sidebar", () => {
before(() => {
cy.visit("/login");
cy.login();
cy.visit("/app/doctype");

return cy
.window()
.its("frappe")
.then((frappe) => {
return frappe.call("frappe.tests.ui_test_helpers.create_blog_post");
});
});

it("Verify attachment visibility config", () => {
verify_attachment_visibility("doctype/Blog Post", true);
verify_attachment_visibility("blog-post/test-blog-attachment-post", false);
});

it('Test for checking "Assigned To" counter value, adding filter and adding & removing an assignment', () => {
cy.visit("/app/doctype");
cy.click_sidebar_button("Assigned To");

//To check if no filter is available in "Assigned To" dropdown


+ 14
- 13
cypress/integration/web_form.js Просмотреть файл

@@ -45,7 +45,7 @@ context("Web Form", () => {
cy.login();
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "Form Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.get('input[data-fieldname="login_required"]').check({ force: true });

cy.save();
@@ -65,7 +65,8 @@ context("Web Form", () => {
cy.login();
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "List Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.get(".section-head").contains("List Settings").click();
cy.get('input[data-fieldname="show_list"]').check();

cy.save();
@@ -78,7 +79,7 @@ context("Web Form", () => {
it("Show Custom List Title", () => {
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "List Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.fill_field("list_title", "Note List");

cy.save();
@@ -97,7 +98,7 @@ context("Web Form", () => {

cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "List Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();

cy.get('[data-fieldname="list_columns"] .grid-footer button')
.contains("Add Row")
@@ -108,19 +109,19 @@ context("Web Form", () => {
cy.get("@grid-rows").find('.grid-row:first [data-fieldname="fieldname"]').click();
cy.get("@grid-rows")
.find('.grid-row:first select[data-fieldname="fieldname"]')
.select("Title (Data)");
.select("Title");

cy.get("@add-row").click();
cy.get("@grid-rows").find('.grid-row[data-idx="2"] [data-fieldname="fieldname"]').click();
cy.get("@grid-rows")
.find('.grid-row[data-idx="2"] select[data-fieldname="fieldname"]')
.select("Public (Check)");
.select("Public");

cy.get("@add-row").click();
cy.get("@grid-rows").find('.grid-row:last [data-fieldname="fieldname"]').click();
cy.get("@grid-rows")
.find('.grid-row:last select[data-fieldname="fieldname"]')
.select("Content (Text Editor)");
.select("Content");

cy.save();

@@ -171,7 +172,7 @@ context("Web Form", () => {
it("Edit Mode", () => {
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "Form Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.get('input[data-fieldname="allow_edit"]').check();

cy.save();
@@ -179,7 +180,7 @@ context("Web Form", () => {
cy.visit("/note/Note 1");
cy.url().should("include", "/note/Note%201");

cy.get(".web-form-actions a").contains("Edit").click();
cy.get(".web-form-actions a").contains("Edit Response").click();
cy.url().should("include", "/note/Note%201/edit");

// Editable Field
@@ -194,7 +195,7 @@ context("Web Form", () => {
it("Allow Multiple Response", () => {
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "Form Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.get('input[data-fieldname="allow_multiple"]').check();

cy.save();
@@ -212,7 +213,7 @@ context("Web Form", () => {
it("Allow Delete", () => {
cy.visit("/app/web-form/note");

cy.findByRole("tab", { name: "Form Settings" }).click();
cy.findByRole("tab", { name: "Settings" }).click();
cy.get('input[data-fieldname="allow_delete"]').check();

cy.save();
@@ -235,7 +236,7 @@ context("Web Form", () => {
it("Navigate and Submit a WebForm", () => {
cy.visit("/update-profile");

cy.get(".web-form-actions a").contains("Edit").click();
cy.get(".web-form-actions a").contains("Edit Response").click();

cy.fill_field("middle_name", "_Test User");

@@ -247,7 +248,7 @@ context("Web Form", () => {
cy.call("frappe.tests.ui_test_helpers.update_webform_to_multistep").then(() => {
cy.visit("/update-profile-duplicate");

cy.get(".web-form-actions a").contains("Edit").click();
cy.get(".web-form-actions a").contains("Edit Response").click();

cy.fill_field("middle_name", "_Test User");



+ 4
- 3
frappe/automation/doctype/assignment_rule/test_assignment_rule.py Просмотреть файл

@@ -1,16 +1,16 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# License: MIT. See LICENSE

import unittest

import frappe
from frappe.test_runner import make_test_records
from frappe.tests.utils import FrappeTestCase
from frappe.utils import random_string


class TestAutoAssign(unittest.TestCase):
class TestAutoAssign(FrappeTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
frappe.db.delete("Assignment Rule")

@classmethod
@@ -274,6 +274,7 @@ class TestAutoAssign(unittest.TestCase):
self.assertNotEqual(frappe.utils.get_date_str(note2_todo.date), note1.expiry_date)
self.assertEqual(frappe.utils.get_date_str(note2_todo.date), expiry_date)
assignment_rule.delete()
frappe.db.commit() # undo changes commited by DDL


def clear_assignments():


+ 2
- 3
frappe/automation/doctype/auto_repeat/test_auto_repeat.py Просмотреть файл

@@ -1,7 +1,5 @@
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.automation.doctype.auto_repeat.auto_repeat import (
create_repeated_entries,
@@ -9,6 +7,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.utils import FrappeTestCase
from frappe.utils import add_days, add_months, getdate, today


@@ -26,7 +25,7 @@ def add_custom_fields():
create_custom_field("ToDo", df)


class TestAutoRepeat(unittest.TestCase):
class TestAutoRepeat(FrappeTestCase):
def setUp(self):
if not frappe.db.sql(
"SELECT `fieldname` FROM `tabCustom Field` WHERE `fieldname`='auto_repeat' and `dt`=%s", "Todo"


+ 2
- 2
frappe/automation/doctype/milestone/test_milestone.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestMilestone(unittest.TestCase):
class TestMilestone(FrappeTestCase):
pass

+ 2
- 3
frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py Просмотреть файл

@@ -1,12 +1,11 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
import frappe.cache_manager
from frappe.tests.utils import FrappeTestCase


class TestMilestoneTracker(unittest.TestCase):
class TestMilestoneTracker(FrappeTestCase):
def test_milestone(self):
frappe.db.delete("Milestone Tracker")



+ 56
- 0
frappe/commands/site.py Просмотреть файл

@@ -496,6 +496,32 @@ def add_system_manager(context, email, first_name, last_name, send_welcome_email
raise SiteNotSpecifiedError


@click.command("add-user")
@click.argument("email")
@click.option("--first-name")
@click.option("--last-name")
@click.option("--password")
@click.option("--user-type")
@click.option("--add-role", multiple=True)
@click.option("--send-welcome-email", default=False, is_flag=True)
@pass_context
def add_user_for_sites(
context, email, first_name, last_name, user_type, send_welcome_email, password, add_role
):
"Add user to a site"
import frappe.utils.user

for site in context.sites:
frappe.connect(site=site)
try:
add_new_user(email, first_name, last_name, user_type, send_welcome_email, password, add_role)
frappe.db.commit()
finally:
frappe.destroy()
if not context.sites:
raise SiteNotSpecifiedError


@click.command("disable-user")
@click.argument("email")
@pass_context
@@ -1275,8 +1301,38 @@ def handle_data(data: dict, format="json"):
render_table(data)


def add_new_user(
email,
first_name=None,
last_name=None,
user_type="System User",
send_welcome_email=False,
password=None,
role=None,
):
user = frappe.new_doc("User")
user.update(
{
"name": email,
"email": email,
"enabled": 1,
"first_name": first_name or email,
"last_name": last_name,
"user_type": user_type,
"send_welcome_email": 1 if send_welcome_email else 0,
}
)
user.insert()
user.add_roles(*role)
if password:
from frappe.utils.password import update_password

update_password(user=user.name, pwd=password)


commands = [
add_system_manager,
add_user_for_sites,
backup,
drop_site,
install_app,


+ 2
- 3
frappe/contacts/doctype/address/test_address.py Просмотреть файл

@@ -1,12 +1,11 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.contacts.doctype.address.address import get_address_display
from frappe.tests.utils import FrappeTestCase


class TestAddress(unittest.TestCase):
class TestAddress(FrappeTestCase):
def test_template_works(self):
if not frappe.db.exists("Address Template", "India"):
frappe.get_doc({"doctype": "Address Template", "country": "India", "is_default": 1}).insert()


+ 2
- 3
frappe/contacts/doctype/address_template/test_address_template.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestAddressTemplate(unittest.TestCase):
class TestAddressTemplate(FrappeTestCase):
def setUp(self):
self.make_default_address_template()



+ 2
- 3
frappe/contacts/doctype/contact/test_contact.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_dependencies = ["Contact", "Salutation"]


class TestContact(unittest.TestCase):
class TestContact(FrappeTestCase):
def test_check_default_email(self):
emails = [
{"email": "test1@example.com", "is_primary": 0},


+ 2
- 2
frappe/contacts/doctype/gender/test_gender.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestGender(unittest.TestCase):
class TestGender(FrappeTestCase):
pass

+ 2
- 2
frappe/contacts/doctype/salutation/test_salutation.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestSalutation(unittest.TestCase):
class TestSalutation(FrappeTestCase):
pass

+ 2
- 3
frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py Просмотреть файл

@@ -1,8 +1,7 @@
import unittest

import frappe
import frappe.defaults
from frappe.contacts.report.addresses_and_contacts.addresses_and_contacts import get_data
from frappe.tests.utils import FrappeTestCase


def get_custom_linked_doctype():
@@ -87,7 +86,7 @@ def create_linked_contact(link_list, address):
frappe.flags.test_contact_created = True


class TestAddressesAndContacts(unittest.TestCase):
class TestAddressesAndContacts(FrappeTestCase):
def test_get_data(self):
linked_docs = [get_custom_doc_for_address_and_contacts()]
links_list = [item.name for item in linked_docs]


+ 4
- 4
frappe/core/doctype/access_log/test_access_log.py Просмотреть файл

@@ -4,9 +4,6 @@
import base64
import os

# imports - standard imports
import unittest

# imports - third party imports
import requests

@@ -15,10 +12,13 @@ import frappe
from frappe.core.doctype.access_log.access_log import make_access_log
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.utils import FrappeTestCase
from frappe.utils import cstr, get_site_url


class TestAccessLog(unittest.TestCase):
class TestAccessLog(FrappeTestCase):
def setUp(self):
# generate keys for current user to send requests for the following tests
generate_keys(frappe.session.user)


+ 2
- 2
frappe/core/doctype/activity_log/test_activity_log.py Просмотреть файл

@@ -1,13 +1,13 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import time
import unittest

import frappe
from frappe.auth import CookieManager, LoginManager
from frappe.tests.utils import FrappeTestCase


class TestActivityLog(unittest.TestCase):
class TestActivityLog(FrappeTestCase):
def test_activity_log(self):

# test user login log


+ 2
- 2
frappe/core/doctype/comment/test_comment.py Просмотреть файл

@@ -1,12 +1,12 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import json
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestComment(unittest.TestCase):
class TestComment(FrappeTestCase):
def tearDown(self):
frappe.form_dict.comment = None
frappe.form_dict.comment_email = None


+ 0
- 1
frappe/core/doctype/communication/test_communication.py Просмотреть файл

@@ -1,6 +1,5 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from typing import TYPE_CHECKING
from urllib.parse import quote



+ 2
- 2
frappe/core/doctype/custom_docperm/test_custom_docperm.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Custom DocPerm')


class TestCustomDocPerm(unittest.TestCase):
class TestCustomDocPerm(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/custom_role/test_custom_role.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Custom Role')


class TestCustomRole(unittest.TestCase):
class TestCustomRole(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/data_export/test_data_exporter.py Просмотреть файл

@@ -1,12 +1,11 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.data_export.exporter import DataExporter
from frappe.tests.utils import FrappeTestCase


class TestDataExporter(unittest.TestCase):
class TestDataExporter(FrappeTestCase):
def setUp(self):
self.doctype_name = "Test DocType for Export Tool"
self.doc_name = "Test Data for Export Tool"


+ 10
- 10
frappe/core/doctype/data_import/importer.py Просмотреть файл

@@ -990,10 +990,11 @@ class Column:
not_exists = list(set(values) - set(exists))
if not_exists:
missing_values = ", ".join(not_exists)
message = _("The following values do not exist for {0}: {1}")
self.warnings.append(
{
"col": self.column_number,
"message": (f"The following values do not exist for {self.df.options}: {missing_values}"),
"message": message.format(self.df.options, missing_values),
"type": "warning",
}
)
@@ -1003,17 +1004,18 @@ class Column:
if not self.date_format:
if self.df.fieldtype == "Time":
self.date_format = "%H:%M:%S"
format = "HH:mm:ss"
date_format = "HH:mm:ss"
else:
self.date_format = "%Y-%m-%d"
format = "yyyy-mm-dd"
date_format = "yyyy-mm-dd"

message = _(
"{0} format could not be determined from the values in this column. Defaulting to {1}."
)
self.warnings.append(
{
"col": self.column_number,
"message": _(
"{0} format could not be determined from the values in this column. Defaulting to {1}."
).format(self.df.fieldtype, format),
"message": message.format(self.df.fieldtype, date_format),
"type": "info",
}
)
@@ -1025,13 +1027,11 @@ class Column:
if invalid:
valid_values = ", ".join(frappe.bold(o) for o in options)
invalid_values = ", ".join(frappe.bold(i) for i in invalid)
message = _("The following values are invalid: {0}. Values must be one of {1}")
self.warnings.append(
{
"col": self.column_number,
"message": (
"The following values are invalid: {}. Values must be"
" one of {}".format(invalid_values, valid_values)
),
"message": message.format(invalid_values, valid_values),
}
)



+ 2
- 2
frappe/core/doctype/data_import/test_data_import.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDataImport(unittest.TestCase):
class TestDataImport(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/data_import/test_exporter.py Просмотреть файл

@@ -1,15 +1,14 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

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.utils import FrappeTestCase

doctype_name = "DocType for Export"


class TestExporter(unittest.TestCase):
class TestExporter(FrappeTestCase):
def setUp(self):
create_doctype_if_not_exists(doctype_name)



+ 3
- 3
frappe/core/doctype/data_import/test_importer.py Просмотреть файл

@@ -1,18 +1,18 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.data_import.importer import Importer
from frappe.tests.test_query_builder import db_type_is, run_only_if
from frappe.tests.utils import FrappeTestCase
from frappe.utils import format_duration, getdate

doctype_name = "DocType for Import"


class TestImporter(unittest.TestCase):
class TestImporter(FrappeTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
create_doctype_if_not_exists(
doctype_name,
)


+ 2
- 2
frappe/core/doctype/data_import_log/test_data_import_log.py Просмотреть файл

@@ -2,8 +2,8 @@
# See license.txt

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDataImportLog(unittest.TestCase):
class TestDataImportLog(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/deleted_document/test_deleted_document.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Deleted Document')


class TestDeletedDocument(unittest.TestCase):
class TestDeletedDocument(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/docshare/test_docshare.py Просмотреть файл

@@ -1,16 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE

import unittest

import frappe
import frappe.share
from frappe.automation.doctype.auto_repeat.test_auto_repeat import create_submittable_doctype
from frappe.tests.utils import FrappeTestCase

test_dependencies = ["User"]


class TestDocShare(unittest.TestCase):
class TestDocShare(FrappeTestCase):
def setUp(self):
self.user = "test@example.com"
self.event = frappe.get_doc(


+ 8
- 1
frappe/core/doctype/doctype/doctype.json Просмотреть файл

@@ -44,6 +44,7 @@
"allow_import",
"allow_events_in_timeline",
"allow_auto_repeat",
"make_attachments_public",
"view_settings",
"title_field",
"show_title_field_in_link",
@@ -598,6 +599,12 @@
"fieldname": "translated_doctype",
"fieldtype": "Check",
"label": "Translate Link Fields"
},
{
"default": "0",
"fieldname": "make_attachments_public",
"fieldtype": "Check",
"label": "Make Attachments Public by Default"
}
],
"icon": "fa fa-bolt",
@@ -680,7 +687,7 @@
"link_fieldname": "reference_doctype"
}
],
"modified": "2022-08-05 18:33:27.315351",
"modified": "2022-08-24 06:42:27.779699",
"modified_by": "Administrator",
"module": "Core",
"name": "DocType",


+ 2
- 2
frappe/core/doctype/doctype/test_doctype.py Просмотреть файл

@@ -2,7 +2,6 @@
# License: MIT. See LICENSE
import random
import string
import unittest
from unittest.mock import patch

import frappe
@@ -19,9 +18,10 @@ from frappe.core.doctype.doctype.doctype import (
)
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.desk.form.load import getdoc
from frappe.tests.utils import FrappeTestCase


class TestDocType(unittest.TestCase):
class TestDocType(FrappeTestCase):
def tearDown(self):
frappe.db.rollback()



+ 2
- 3
frappe/core/doctype/document_naming_rule/test_document_naming_rule.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestDocumentNamingRule(unittest.TestCase):
class TestDocumentNamingRule(FrappeTestCase):
def test_naming_rule_by_series(self):
naming_rule = frappe.get_doc(
dict(doctype="Document Naming Rule", document_type="ToDo", prefix="test-todo-", prefix_digits=5)


+ 2
- 2
frappe/core/doctype/document_naming_rule_condition/test_document_naming_rule_condition.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDocumentNamingRuleCondition(unittest.TestCase):
class TestDocumentNamingRuleCondition(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/document_share_key/test_document_share_key.py Просмотреть файл

@@ -2,8 +2,8 @@
# See license.txt

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDocumentShareKey(unittest.TestCase):
class TestDocumentShareKey(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/domain/test_domain.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDomain(unittest.TestCase):
class TestDomain(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/error_log/test_error_log.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Error Log')


class TestErrorLog(unittest.TestCase):
class TestErrorLog(FrappeTestCase):
def test_error_log(self):
"""let's do an error log on error log?"""
doc = frappe.new_doc("Error Log")


+ 2
- 2
frappe/core/doctype/error_snapshot/test_error_snapshot.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Error Snapshot')


class TestErrorSnapshot(unittest.TestCase):
class TestErrorSnapshot(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/file/test_file.py Просмотреть файл

@@ -3,7 +3,6 @@
import base64
import json
import os
import unittest
from contextlib import contextmanager
from typing import TYPE_CHECKING

@@ -521,11 +520,12 @@ class TestFile(FrappeTestCase):
assert test_file is not None


class TestAttachment(unittest.TestCase):
class TestAttachment(FrappeTestCase):
test_doctype = "Test For Attachment"

@classmethod
def setUpClass(cls):
super().setUpClass()
frappe.get_doc(
doctype="DocType",
name=cls.test_doctype,


+ 2
- 2
frappe/core/doctype/installed_applications/test_installed_applications.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestInstalledApplications(unittest.TestCase):
class TestInstalledApplications(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/language/test_language.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Language')


class TestLanguage(unittest.TestCase):
class TestLanguage(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/log_setting_user/test_log_setting_user.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestLogSettingUser(unittest.TestCase):
class TestLogSettingUser(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/module_def/test_module_def.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Module Def')


class TestModuleDef(unittest.TestCase):
class TestModuleDef(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/module_profile/test_module_profile.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestModuleProfile(unittest.TestCase):
class TestModuleProfile(FrappeTestCase):
def test_make_new_module_profile(self):
if not frappe.db.get_value("Module Profile", "_Test Module Profile"):
frappe.get_doc(


+ 2
- 2
frappe/core/doctype/navbar_item/test_navbar_item.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestNavbarItem(unittest.TestCase):
class TestNavbarItem(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/navbar_settings/test_navbar_settings.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestNavbarSettings(unittest.TestCase):
class TestNavbarSettings(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/package/test_package.py Просмотреть файл

@@ -3,12 +3,12 @@

import json
import os
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestPackage(unittest.TestCase):
class TestPackage(FrappeTestCase):
def test_package_release(self):
make_test_package()
make_test_module()


+ 2
- 2
frappe/core/doctype/package_import/test_package_import.py Просмотреть файл

@@ -2,8 +2,8 @@
# See license.txt

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestPackageImport(unittest.TestCase):
class TestPackageImport(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/package_release/test_package_release.py Просмотреть файл

@@ -2,8 +2,8 @@
# See license.txt

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestPackageRelease(unittest.TestCase):
class TestPackageRelease(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/page/test_page.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_records = frappe.get_test_records("Page")


class TestPage(unittest.TestCase):
class TestPage(FrappeTestCase):
def test_naming(self):
self.assertRaises(
frappe.NameError,


+ 2
- 2
frappe/core/doctype/patch_log/test_patch_log.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Patch Log')


class TestPatchLog(unittest.TestCase):
class TestPatchLog(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/prepared_report/test_prepared_report.py Просмотреть файл

@@ -1,12 +1,12 @@
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import json
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestPreparedReport(unittest.TestCase):
class TestPreparedReport(FrappeTestCase):
def setUp(self):
self.report = frappe.get_doc({"doctype": "Report", "name": "Permitted Documents For User"})
self.filters = {"user": "Administrator", "doctype": "Role"}


+ 2
- 2
frappe/core/doctype/role/test_role.py Просмотреть файл

@@ -1,14 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.role.role import get_info_based_on_role
from frappe.tests.utils import FrappeTestCase

test_records = frappe.get_test_records("Role")


class TestUser(unittest.TestCase):
class TestUser(FrappeTestCase):
def test_disable_role(self):
frappe.get_doc("User", "test@example.com").add_roles("_Test Role 3")



+ 2
- 3
frappe/core/doctype/role_profile/test_role_profile.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_dependencies = ["Role"]


class TestRoleProfile(unittest.TestCase):
class TestRoleProfile(FrappeTestCase):
def test_make_new_role_profile(self):
frappe.delete_doc_if_exists("Role Profile", "Test 1", force=1)
new_role_profile = frappe.get_doc(dict(doctype="Role Profile", role_profile="Test 1")).insert()


+ 2
- 2
frappe/core/doctype/scheduled_job_log/test_scheduled_job_log.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestScheduledJobLog(unittest.TestCase):
class TestScheduledJobLog(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/scheduled_job_type/test_scheduled_job_type.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
from frappe.tests.utils import FrappeTestCase
from frappe.utils import get_datetime


class TestScheduledJobType(unittest.TestCase):
class TestScheduledJobType(FrappeTestCase):
def setUp(self):
frappe.db.rollback()
frappe.db.truncate("Scheduled Job Type")


+ 3
- 4
frappe/core/doctype/server_script/test_server_script.py Просмотреть файл

@@ -1,10 +1,9 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import requests

import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils import get_site_url

scripts = [
@@ -86,10 +85,10 @@ frappe.db.add_index("Todo", ["color", "date"])
]


class TestServerScript(unittest.TestCase):
class TestServerScript(FrappeTestCase):
@classmethod
def setUpClass(cls):
frappe.db.commit()
super().setUpClass()
frappe.db.truncate("Server Script")
frappe.get_doc("User", "Administrator").add_roles("Script Manager")
for script in scripts:


+ 2
- 3
frappe/core/doctype/session_default_settings/test_session_default_settings.py Просмотреть файл

@@ -1,15 +1,14 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.session_default_settings.session_default_settings import (
clear_session_defaults,
set_session_default_values,
)
from frappe.tests.utils import FrappeTestCase


class TestSessionDefaultSettings(unittest.TestCase):
class TestSessionDefaultSettings(FrappeTestCase):
def test_set_session_default_settings(self):
frappe.set_user("Administrator")
settings = frappe.get_single("Session Default Settings")


+ 2
- 2
frappe/core/doctype/sms_settings/test_sms_settings.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestSMSSettings(unittest.TestCase):
class TestSMSSettings(FrappeTestCase):
pass

+ 1
- 1
frappe/core/doctype/system_settings/system_settings.js Просмотреть файл

@@ -7,7 +7,7 @@ frappe.ui.form.on("System Settings", {
frm.set_df_property("time_zone", "options", frappe.all_timezones);

$.each(data.message.defaults, function (key, val) {
frm.set_value(key, val);
frm.set_value(key, val, null, true);
frappe.sys_defaults[key] = val;
});
if (frm.re_setup_moment) {


+ 2
- 2
frappe/core/doctype/system_settings/test_system_settings.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestSystemSettings(unittest.TestCase):
class TestSystemSettings(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/transaction_log/test_transaction_log.py Просмотреть файл

@@ -1,14 +1,14 @@
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import hashlib
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_records = []


class TestTransactionLog(unittest.TestCase):
class TestTransactionLog(FrappeTestCase):
def test_validate_chaining(self):
frappe.get_doc(
{


+ 15
- 10
frappe/core/doctype/translation/test_translation.py Просмотреть файл

@@ -1,29 +1,29 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe import _
from frappe.tests.utils import FrappeTestCase


class TestTranslation(unittest.TestCase):
class TestTranslation(FrappeTestCase):
def setUp(self):
frappe.db.delete("Translation")

def tearDown(self):
frappe.local.lang = "en"
frappe.local.lang_full_dict = None
clear_translation_cache()

def test_doctype(self):
translation_data = get_translation_data()
for key, val in translation_data.items():
frappe.local.lang = key
frappe.local.lang_full_dict = None

clear_translation_cache()
translation = create_translation(key, val)
self.assertEqual(_(val[0]), val[1])

frappe.delete_doc("Translation", translation.name)
frappe.local.lang_full_dict = None
clear_translation_cache()

self.assertEqual(_(val[0]), val[0])

@@ -39,20 +39,20 @@ class TestTranslation(unittest.TestCase):

frappe.local.lang = "es"

frappe.local.lang_full_dict = None
clear_translation_cache()
self.assertTrue(_(data[0][0]), data[0][1])

frappe.local.lang_full_dict = None
clear_translation_cache()
self.assertTrue(_(data[1][0]), data[1][1])

frappe.local.lang = "es-MX"

# different translation for es-MX
frappe.local.lang_full_dict = None
clear_translation_cache()
self.assertTrue(_(data[2][0]), data[2][1])

# from spanish (general)
frappe.local.lang_full_dict = None
clear_translation_cache()
self.assertTrue(_(data[1][0]), data[1][1])

def test_html_content_data_translation(self):
@@ -110,3 +110,8 @@ def create_translation(key, val):
translation.translated_text = val[1]
translation.save()
return translation


def clear_translation_cache():
frappe.local.lang_full_dict = None
frappe.cache().delete_key("lang_full_dict", shared=True)

+ 2
- 2
frappe/core/doctype/user/test_user.py Просмотреть файл

@@ -2,7 +2,6 @@
# License: MIT. See LICENSE
import json
import time
import unittest
from unittest.mock import patch

import frappe
@@ -18,13 +17,14 @@ 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.utils import FrappeTestCase
from frappe.utils import get_url

user_module = frappe.core.doctype.user.user
test_records = frappe.get_test_records("User")


class TestUser(unittest.TestCase):
class TestUser(FrappeTestCase):
def tearDown(self):
# disable password strength test
frappe.db.set_value("System Settings", "System Settings", "enable_password_policy", 0)


+ 2
- 2
frappe/core/doctype/user_group/test_user_group.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestUserGroup(unittest.TestCase):
class TestUserGroup(FrappeTestCase):
pass

+ 2
- 2
frappe/core/doctype/user_group_member/test_user_group_member.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestUserGroupMember(unittest.TestCase):
class TestUserGroupMember(FrappeTestCase):
pass

+ 2
- 3
frappe/core/doctype/user_permission/test_user_permission.py Просмотреть файл

@@ -1,7 +1,5 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# See LICENSE
import unittest

import frappe
from frappe.core.doctype.doctype.test_doctype import new_doctype
from frappe.core.doctype.user_permission.user_permission import (
@@ -9,10 +7,11 @@ from frappe.core.doctype.user_permission.user_permission import (
remove_applicable,
)
from frappe.permissions import has_user_permission
from frappe.tests.utils import FrappeTestCase
from frappe.website.doctype.blog_post.test_blog_post import make_test_blog


class TestUserPermission(unittest.TestCase):
class TestUserPermission(FrappeTestCase):
def setUp(self):
test_users = (
"test_bulk_creation_update@example.com",


+ 2
- 3
frappe/core/doctype/user_type/test_user_type.py Просмотреть файл

@@ -1,12 +1,11 @@
# Copyright (c) 2021, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.installer import update_site_config
from frappe.tests.utils import FrappeTestCase


class TestUserType(unittest.TestCase):
class TestUserType(FrappeTestCase):
def setUp(self):
create_role()



+ 2
- 2
frappe/core/doctype/version/test_version.py Просмотреть файл

@@ -1,14 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import copy
import unittest

import frappe
from frappe.core.doctype.version.version import get_diff
from frappe.test_runner import make_test_objects
from frappe.tests.utils import FrappeTestCase


class TestVersion(unittest.TestCase):
class TestVersion(FrappeTestCase):
def test_get_diff(self):
frappe.set_user("Administrator")
test_records = make_test_objects("Event", reset=True)


+ 2
- 3
frappe/core/doctype/view_log/test_view_log.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestViewLog(unittest.TestCase):
class TestViewLog(FrappeTestCase):
def tearDown(self):
frappe.set_user("Administrator")



+ 2
- 2
frappe/custom/doctype/client_script/test_client_script.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Client Script')


class TestClientScript(unittest.TestCase):
class TestClientScript(FrappeTestCase):
pass

+ 2
- 3
frappe/custom/doctype/custom_field/test_custom_field.py Просмотреть файл

@@ -1,14 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE

import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_records = frappe.get_test_records("Custom Field")


class TestCustomField(unittest.TestCase):
class TestCustomField(FrappeTestCase):
def test_create_custom_fields(self):
from .custom_field import create_custom_fields



+ 23
- 4
frappe/custom/doctype/customize_form/customize_form.json Просмотреть файл

@@ -10,10 +10,8 @@
"doc_type",
"properties",
"label",
"max_attachments",
"search_fields",
"column_break_5",
"allow_copy",
"istable",
"editable_grid",
"quick_entry",
@@ -26,11 +24,16 @@
"naming_section",
"naming_rule",
"autoname",
"form_settings_section",
"image_field",
"max_attachments",
"column_break_21",
"allow_copy",
"make_attachments_public",
"view_settings_section",
"title_field",
"show_title_field_in_link",
"translated_doctype",
"image_field",
"default_print_format",
"column_break_29",
"show_preview_popup",
@@ -318,6 +321,22 @@
"fieldname": "translated_doctype",
"fieldtype": "Check",
"label": "Translate Link Fields"
},
{
"collapsible": 1,
"fieldname": "form_settings_section",
"fieldtype": "Section Break",
"label": "Form Settings"
},
{
"fieldname": "column_break_21",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "make_attachments_public",
"fieldtype": "Check",
"label": "Make Attachments Public by Default"
}
],
"hide_toolbar": 1,
@@ -326,7 +345,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2022-08-04 15:36:16.772277",
"modified": "2022-08-24 06:57:47.966331",
"modified_by": "Administrator",
"module": "Custom",
"name": "Customize Form",


+ 1
- 0
frappe/custom/doctype/customize_form/customize_form.py Просмотреть файл

@@ -573,6 +573,7 @@ doctype_properties = {
"quick_entry": "Check",
"editable_grid": "Check",
"max_attachments": "Int",
"make_attachments_public": "Check",
"track_changes": "Check",
"track_views": "Check",
"allow_auto_repeat": "Check",


+ 2
- 2
frappe/custom/doctype/customize_form/test_customize_form.py Просмотреть файл

@@ -2,17 +2,17 @@
# License: MIT. See LICENSE

import json
import unittest

import frappe
from frappe.core.doctype.doctype.doctype import InvalidFieldNameError
from frappe.core.doctype.doctype.test_doctype import new_doctype
from frappe.test_runner import make_test_records_for_doctype
from frappe.tests.utils import FrappeTestCase

test_dependencies = ["Custom Field", "Property Setter"]


class TestCustomizeForm(unittest.TestCase):
class TestCustomizeForm(FrappeTestCase):
def insert_custom_field(self):
frappe.delete_doc_if_exists("Custom Field", "Event-test_custom_field")
frappe.get_doc(


+ 2
- 2
frappe/custom/doctype/doctype_layout/test_doctype_layout.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDocTypeLayout(unittest.TestCase):
class TestDocTypeLayout(FrappeTestCase):
pass

+ 2
- 2
frappe/custom/doctype/property_setter/test_property_setter.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Property Setter')


class TestPropertySetter(unittest.TestCase):
class TestPropertySetter(FrappeTestCase):
pass

+ 1
- 2
frappe/defaults.py Просмотреть файл

@@ -6,8 +6,7 @@ from frappe.cache_manager import clear_defaults_cache, common_default_keys
from frappe.desk.notifications import clear_notifications
from frappe.query_builder import DocType

# Note: DefaultValue records are identified by parenttype
# __default, __global or 'User Permission'
# Note: DefaultValue records are identified by parent (e.g. __default, __global)


def set_user_default(key, value, user=None, parenttype=None):


+ 2
- 2
frappe/desk/doctype/console_log/test_console_log.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestConsoleLog(unittest.TestCase):
class TestConsoleLog(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/dashboard/test_dashboard.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDashboard(unittest.TestCase):
class TestDashboard(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/dashboard_chart_source/test_dashboard_chart_source.py Просмотреть файл

@@ -1,7 +1,7 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase


class TestDashboardChartSource(unittest.TestCase):
class TestDashboardChartSource(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/event/test_event.py Просмотреть файл

@@ -3,17 +3,17 @@
"""Use blog post test to test user permissions logic"""

import json
import unittest

import frappe
import frappe.defaults
from frappe.desk.doctype.event.event import get_events
from frappe.test_runner import make_test_objects
from frappe.tests.utils import FrappeTestCase

test_records = frappe.get_test_records("Event")


class TestEvent(unittest.TestCase):
class TestEvent(FrappeTestCase):
def setUp(self):
frappe.db.delete("Event")
make_test_objects("Event", reset=True)


+ 2
- 2
frappe/desk/doctype/form_tour/test_form_tour.py Просмотреть файл

@@ -2,8 +2,8 @@
# License: MIT. See LICENSE

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestFormTour(unittest.TestCase):
class TestFormTour(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/kanban_board/test_kanban_board.py Просмотреть файл

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from frappe.tests.utils import FrappeTestCase

# test_records = frappe.get_test_records('Kanban Board')


class TestKanbanBoard(unittest.TestCase):
class TestKanbanBoard(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/list_view_settings/test_list_view_settings.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestListViewSettings(unittest.TestCase):
class TestListViewSettings(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/module_onboarding/test_module_onboarding.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestModuleOnboarding(unittest.TestCase):
class TestModuleOnboarding(FrappeTestCase):
pass

+ 2
- 3
frappe/desk/doctype/note/test_note.py Просмотреть файл

@@ -1,14 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# License: MIT. See LICENSE

import unittest

import frappe
from frappe.tests.utils import FrappeTestCase

test_records = frappe.get_test_records("Note")


class TestNote(unittest.TestCase):
class TestNote(FrappeTestCase):
def insert_note(self):
frappe.db.delete("Version")
frappe.db.delete("Note")


+ 2
- 3
frappe/desk/doctype/notification_log/test_notification_log.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.user.user import get_system_users
from frappe.desk.form.assign_to import add as assign_task
from frappe.tests.utils import FrappeTestCase


class TestNotificationLog(unittest.TestCase):
class TestNotificationLog(FrappeTestCase):
def test_assignment(self):
todo = get_todo()
user = get_user()


+ 2
- 2
frappe/desk/doctype/notification_settings/test_notification_settings.py Просмотреть файл

@@ -2,8 +2,8 @@
# See license.txt

# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestNotificationSettings(unittest.TestCase):
class TestNotificationSettings(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/number_card/test_number_card.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestNumberCard(unittest.TestCase):
class TestNumberCard(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/onboarding_permission/test_onboarding_permission.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestOnboardingPermission(unittest.TestCase):
class TestOnboardingPermission(FrappeTestCase):
pass

+ 2
- 2
frappe/desk/doctype/onboarding_step/test_onboarding_step.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestOnboardingStep(unittest.TestCase):
class TestOnboardingStep(FrappeTestCase):
pass

+ 2
- 3
frappe/desk/doctype/system_console/test_system_console.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestSystemConsole(unittest.TestCase):
class TestSystemConsole(FrappeTestCase):
def test_system_console(self):
system_console = frappe.get_doc("System Console")
system_console.console = 'log("hello")'


+ 2
- 3
frappe/desk/doctype/tag/test_tag.py Просмотреть файл

@@ -1,11 +1,10 @@
import unittest

import frappe
from frappe.desk.doctype.tag.tag import add_tag
from frappe.desk.reportview import get_stats
from frappe.tests.utils import FrappeTestCase


class TestTag(unittest.TestCase):
class TestTag(FrappeTestCase):
def setUp(self) -> None:
frappe.db.delete("Tag")
frappe.db.sql("UPDATE `tabDocType` set _user_tags=''")


+ 2
- 2
frappe/desk/doctype/tag_link/test_tag_link.py Просмотреть файл

@@ -1,8 +1,8 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
from frappe.tests.utils import FrappeTestCase


class TestTagLink(unittest.TestCase):
class TestTagLink(FrappeTestCase):
pass

+ 2
- 3
frappe/desk/doctype/todo/test_todo.py Просмотреть файл

@@ -1,16 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.core.doctype.doctype.doctype import clear_permissions_cache
from frappe.model.db_query import DatabaseQuery
from frappe.permissions import add_permission, reset_perms
from frappe.tests.utils import FrappeTestCase

test_dependencies = ["User"]


class TestToDo(unittest.TestCase):
class TestToDo(FrappeTestCase):
def test_delete(self):
todo = frappe.get_doc(
dict(doctype="ToDo", description="test todo", assigned_by="Administrator")


+ 2
- 3
frappe/desk/doctype/workspace/test_workspace.py Просмотреть файл

@@ -1,11 +1,10 @@
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase


class TestWorkspace(unittest.TestCase):
class TestWorkspace(FrappeTestCase):
def setUp(self):
create_module("Test Module")



+ 4
- 3
frappe/desk/form/test_form.py Просмотреть файл

@@ -1,13 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE

import unittest

import frappe
from frappe.desk.form.linked_with import get_linked_docs, get_linked_doctypes
from frappe.tests.utils import FrappeTestCase


class TestForm(unittest.TestCase):
class TestForm(FrappeTestCase):
def test_linked_with(self):
results = get_linked_docs("Role", "System Manager", linkinfo=get_linked_doctypes("Role"))
self.assertTrue("User" in results)
@@ -15,5 +14,7 @@ class TestForm(unittest.TestCase):


if __name__ == "__main__":
import unittest

frappe.connect()
unittest.main()

+ 2
- 2
frappe/email/doctype/auto_email_report/test_auto_email_report.py Просмотреть файл

@@ -1,16 +1,16 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import json
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils import add_to_date, get_link_to_form, today
from frappe.utils.data import is_html

# test_records = frappe.get_test_records('Auto Email Report')


class TestAutoEmailReport(unittest.TestCase):
class TestAutoEmailReport(FrappeTestCase):
def test_auto_email(self):
frappe.delete_doc("Auto Email Report", "Permitted Documents For User")



+ 2
- 2
frappe/email/doctype/document_follow/test_document_follow.py Просмотреть файл

@@ -1,6 +1,5 @@
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from dataclasses import dataclass

import frappe
@@ -12,9 +11,10 @@ from frappe.desk.like import toggle_like
from frappe.query_builder import DocType
from frappe.query_builder.functions import Cast_
from frappe.share import add as share
from frappe.tests.utils import FrappeTestCase


class TestDocumentFollow(unittest.TestCase):
class TestDocumentFollow(FrappeTestCase):
def test_document_follow_version(self):
user = get_user()
event_doc = get_event()


+ 17
- 36
frappe/email/doctype/email_account/email_account.js Просмотреть файл

@@ -158,7 +158,6 @@ frappe.ui.form.on("Email Account", {
},

refresh: function (frm) {
frm.events.set_domain_fields(frm);
frm.events.enable_incoming(frm);
frm.events.notify_if_unreplied(frm);
frm.events.show_gmail_message_for_less_secure_apps(frm);
@@ -211,42 +210,24 @@ frappe.ui.form.on("Email Account", {
oauth_access(frm);
},

email_id: function (frm) {
//pull domain and if no matching domain go create one
frm.events.update_domain(frm);
},

update_domain: function (frm) {
if (!frm.doc.email_id && !frm.doc.service) {
return;
}

frappe.call({
method: "get_domain",
doc: frm.doc,
args: {
email_id: frm.doc.email_id,
},
callback: function (r) {
if (r.message) {
frm.events.set_domain_fields(frm, r.message);
}
},
});
},

set_domain_fields: function (frm, args) {
if (!args) {
args = frappe.route_flags.set_domain_values ? frappe.route_options : {};
}

for (var field in args) {
frm.set_value(field, args[field]);
domain: frappe.utils.debounce((frm) => {
if (frm.doc.domain) {
frappe.call({
method: "get_domain_values",
doc: frm.doc,
args: {
domain: frm.doc.domain,
},
callback: function (r) {
if (!r.exc) {
for (let field in r.message) {
frm.set_value(field, r.message[field]);
}
}
},
});
}

delete frappe.route_flags.set_domain_values;
frappe.route_options = {};
},
}),

email_sync_option: function (frm) {
// confirm if the ALL sync option is selected


+ 4
- 4
frappe/email/doctype/email_account/email_account.json Просмотреть файл

@@ -145,7 +145,7 @@
"hide_seconds": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Domain (optional)",
"label": "Domain",
"options": "Email Domain"
},
{
@@ -154,7 +154,7 @@
"fieldtype": "Select",
"hide_days": 1,
"hide_seconds": 1,
"label": "Service (optional)",
"label": "Service",
"options": "\nGMail\nSendgrid\nSparkPost\nYahoo Mail\nOutlook.com\nYandex.Mail"
},
{
@@ -615,7 +615,7 @@
"icon": "fa fa-inbox",
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-08-16 13:05:45.445572",
"modified": "2022-08-23 00:31:05.305462",
"modified_by": "Administrator",
"module": "Email",
"name": "Email Account",
@@ -639,4 +639,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}

Некоторые файлы не были показаны из-за большого количества измененных файлов

Загрузка…
Отмена
Сохранить