test: Use FrappeTestCase everywhere

This commit is contained in:
Ankush Menat 2022-06-29 17:28:08 +05:30 committed by Ankush Menat
parent 41af9621cd
commit 3e2d2a703a
213 changed files with 479 additions and 544 deletions

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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")

View file

@ -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()

View file

@ -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()

View file

@ -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},

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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)

View file

@ -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,
)

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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()

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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"}

View file

@ -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")

View file

@ -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()

View file

@ -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

View file

@ -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")

View file

@ -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:

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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(
{

View file

@ -1,12 +1,11 @@
# 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")

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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",

View file

@ -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()

View file

@ -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)

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")'

View file

@ -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=''")

View file

@ -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

View file

@ -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")

View file

@ -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")

View file

@ -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()

View file

@ -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")

View file

@ -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()

View file

@ -3,7 +3,6 @@
import email
import os
import unittest
from datetime import datetime, timedelta
from unittest.mock import patch
@ -14,14 +13,16 @@ from frappe.email.doctype.email_account.email_account import notify_unreplied
from frappe.email.email_body import get_message_id
from frappe.email.receive import Email, InboundMail, SentEmailInInboxError
from frappe.test_runner import make_test_records
from frappe.tests.utils import FrappeTestCase
make_test_records("User")
make_test_records("Email Account")
class TestEmailAccount(unittest.TestCase):
class TestEmailAccount(FrappeTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
email_account.db_set("enable_incoming", 1)
email_account.db_set("enable_auto_reply", 1)
@ -434,9 +435,10 @@ class TestEmailAccount(unittest.TestCase):
email_account.receive()
class TestInboundMail(unittest.TestCase):
class TestInboundMail(FrappeTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
email_account.db_set("enable_incoming", 1)

View file

@ -1,14 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.test_runner import make_test_objects
from frappe.tests.utils import FrappeTestCase
test_records = frappe.get_test_records("Email Domain")
class TestDomain(unittest.TestCase):
class TestDomain(FrappeTestCase):
def setUp(self):
make_test_objects("Email Domain", reset=True)

View file

@ -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('Email Flag Queue')
class TestEmailFlagQueue(unittest.TestCase):
class TestEmailFlagQueue(FrappeTestCase):
pass

View file

@ -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('Email Group')
class TestEmailGroup(unittest.TestCase):
class TestEmailGroup(FrappeTestCase):
pass

View file

@ -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('Email Group Member')
class TestEmailGroupMember(unittest.TestCase):
class TestEmailGroupMember(FrappeTestCase):
pass

View file

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

View file

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

View file

@ -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('Email Unsubscribe')
class TestEmailUnsubscribe(unittest.TestCase):
class TestEmailUnsubscribe(FrappeTestCase):
pass

View file

@ -1,12 +1,13 @@
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
from contextlib import contextmanager
import frappe
import frappe.utils
import frappe.utils.scheduler
from frappe.desk.form import assign_to
from frappe.tests.utils import FrappeTestCase
test_dependencies = ["User", "Notification"]
@ -20,7 +21,7 @@ def get_test_notification(config):
notification.delete()
class TestNotification(unittest.TestCase):
class TestNotification(FrappeTestCase):
def setUp(self):
frappe.db.delete("Email Queue")
frappe.set_user("test@example.com")

View file

@ -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('Unhandled Emails')
class TestUnhandledEmail(unittest.TestCase):
class TestUnhandledEmail(FrappeTestCase):
pass

View file

@ -3,7 +3,6 @@
import base64
import os
import unittest
import frappe
from frappe import safe_decode
@ -15,9 +14,10 @@ from frappe.email.email_body import (
replace_filename_with_cid,
)
from frappe.email.receive import Email
from frappe.tests.utils import FrappeTestCase
class TestEmailBody(unittest.TestCase):
class TestEmailBody(FrappeTestCase):
def setUp(self):
email_html = """
<div>

View file

@ -1,14 +1,13 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: The MIT License
import unittest
import frappe
from frappe.email.doctype.email_account.email_account import EmailAccount
from frappe.email.smtp import SMTPServer
from frappe.tests.utils import FrappeTestCase
class TestSMTP(unittest.TestCase):
class TestSMTP(FrappeTestCase):
def test_smtp_ssl_session(self):
for port in [None, 0, 465, "465"]:
make_server(port, 1, 0)

Some files were not shown because too many files have changed in this diff Show more